Repository navigation
Expand file tree
/
Copy pathmacpython-build-common.sh
More file actions
47 lines (41 loc) · 1.59 KB
/
Copy pathmacpython-build-common.sh
File metadata and controls
47 lines (41 loc) · 1.59 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
# Content common to macpython-build-wheels.sh and
# macpython-build-module-wheels.sh
set -e -x
SCRIPT_DIR=$(cd $(dirname $0) || exit 1; pwd)
MACPYTHON_PY_PREFIX=/Library/Frameworks/Python.framework/Versions
# Versions can be restricted by passing them in as arguments to the script
# For example,
# macpython-build-wheels.sh 2.7 3.5
if [[ $# -eq 0 ]]; then
PYBINARIES=(${MACPYTHON_PY_PREFIX}/*)
else
PYBINARIES=()
for version in "$@"; do
PYBINARIES+=(${MACPYTHON_PY_PREFIX}/*${version}*)
done
fi
VENVS=()
mkdir -p ${SCRIPT_DIR}/../venvs
for PYBIN in "${PYBINARIES[@]}"; do
if [[ $(basename $PYBIN) = "Current" ]]; then
continue
fi
py_mm=$(basename ${PYBIN})
VENV=${SCRIPT_DIR}/../venvs/${py_mm}
VENVS+=(${VENV})
done
# Since the python interpreter exports its symbol (see [1]), python
# modules should not link against any python libraries.
# To ensure it is not the case, we configure the project using an empty
# file as python library.
#
# [1] "Note that libpythonX.Y.so.1 is not on the list of libraries that
# a manylinux1 extension is allowed to link to. Explicitly linking to
# libpythonX.Y.so.1 is unnecessary in almost all cases: the way ELF linking
# works, extension modules that are loaded into the interpreter automatically
# get access to all of the interpreter's symbols, regardless of whether or
# not the extension itself is explicitly linked against libpython. [...]"
#
# Source: https://www.python.org/dev/peps/pep-0513/#libpythonx-y-so-1
PYTHON_LIBRARY=$(cd $(dirname $0); pwd)/internal/libpython-not-needed-symbols-exported-by-interpreter
touch ${PYTHON_LIBRARY}