11#! /usr/bin/env bash
2- set -e -x
3- MACPYTHON_PY_PREFIX=/Library/Frameworks/Python.framework/Versions
4- SCRIPT_DIR=$( cd " $( dirname " ${BASH_SOURCE[0]} " ) " && pwd)
52
3+ # Run this script to build the ITK Python wheel packages for macOS.
4+ #
65# Versions can be restricted by passing them in as arguments to the script
76# For example,
8- # macpython-build-wheels.sh 2.7 3.5
9- if [[ $# -eq 0 ]]; then
10- PYBINARIES=(${MACPYTHON_PY_PREFIX} /* )
11- else
12- PYBINARIES=()
13- for version in " $@ " ; do
14- PYBINARIES+=(${MACPYTHON_PY_PREFIX} /* ${version} * )
15- done
16- fi
7+ #
8+ # scripts/macpython-build-wheels.sh 2.7 3.5
9+
10+ script_dir=" ` cd $( dirname $0 ) ; pwd` "
11+ source " ${script_dir} /macpython-build-common.sh"
1712
1813# Remove previous virtualenv's
1914rm -rf ${SCRIPT_DIR} /../venvs
@@ -31,18 +26,6 @@ for PYBIN in "${PYBINARIES[@]}"; do
3126 VENVS+=(${VENV} )
3227done
3328
34- # Install CMake, Ninja
35- VENV=" ${VENVS[0]} "
36- PYTHON_EXECUTABLE=${VENV} /bin/python
37- $PYTHON_EXECUTABLE -m pip install cmake
38- CMAKE_EXECUTABLE=${VENV} /bin/cmake
39- $PYTHON_EXECUTABLE -m pip install ninja
40- NINJA_EXECUTABLE=${VENV} /bin/ninja
41- $PYTHON_EXECUTABLE -m pip install delocate
42- DELOCATE_LISTDEPS=${VENV} /bin/delocate-listdeps
43- DELOCATE_WHEEL=${VENV} /bin/delocate-wheel
44-
45-
4629# Build standalone project and populate archive cache
4730mkdir -p standalone-build
4831pushd standalone-build > /dev/null 2>&1
@@ -53,22 +36,6 @@ pushd standalone-build > /dev/null 2>&1
5336 $NINJA_EXECUTABLE
5437popd > /dev/null 2>&1
5538
56- # Since the python interpreter exports its symbol (see [1]), python
57- # modules should not link against any python libraries.
58- # To ensure it is not the case, we configure the project using an empty
59- # file as python library.
60- #
61- # [1] "Note that libpythonX.Y.so.1 is not on the list of libraries that
62- # a manylinux1 extension is allowed to link to. Explicitly linking to
63- # libpythonX.Y.so.1 is unnecessary in almost all cases: the way ELF linking
64- # works, extension modules that are loaded into the interpreter automatically
65- # get access to all of the interpreter's symbols, regardless of whether or
66- # not the extension itself is explicitly linked against libpython. [...]"
67- #
68- # Source: https://www.python.org/dev/peps/pep-0513/#libpythonx-y-so-1
69- PYTHON_LIBRARY=${SCRIPT_DIR} /internal/manylinux-libpython-not-needed-symbols-exported-by-interpreter
70- touch ${PYTHON_LIBRARY}
71-
7239# Compile wheels re-using standalone project and archive cache
7340for VENV in " ${VENVS[@]} " ; do
7441 py_mm=$( basename ${VENV} )
0 commit comments