Skip to content

Commit ed0d6a4

Browse files
committed
unix: add a variable with path to python executable
So we can later use a different Python when cross compiling.
1 parent 9f7a5cb commit ed0d6a4

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

cpython-unix/build-cpython.sh

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -276,6 +276,11 @@ else
276276
PYTHON_BINARY_SUFFIX=
277277
fi
278278

279+
# Python interpreter to use during the build.
280+
if [ -z "${BUILD_PYTHON}" ]; then
281+
BUILD_PYTHON=${ROOT}/out/python/install/bin/python3
282+
fi
283+
279284
# If we're building a shared library hack some binaries so rpath is set.
280285
# This ensures we can run the binary in any location without
281286
# LD_LIBRARY_PATH pointing to the directory containing libpython.
@@ -346,7 +351,7 @@ index ec9942f0..1b306ca7 100644
346351
except AttributeError:
347352
EOF
348353

349-
${ROOT}/out/python/install/bin/python3 setup.py install
354+
${BUILD_PYTHON} setup.py install
350355
popd
351356

352357
pushd ${ROOT}/pip-${PIP_VERSION}
@@ -385,7 +390,7 @@ index 60a69d8..08c0597 100644
385390
except AttributeError:
386391
EOF
387392

388-
${ROOT}/out/python/install/bin/python3 setup.py install
393+
${BUILD_PYTHON} setup.py install
389394
popd
390395

391396
# Emit metadata to be used in PYTHON.json.
@@ -430,7 +435,7 @@ EOF
430435

431436
PYTHON_EXE=${ROOT}/out/python/install/bin/$(readlink ${ROOT}/out/python/install/bin/python3)
432437

433-
${ROOT}/out/python/install/bin/python3 ${ROOT}/generate_metadata.py ${ROOT}/metadata.json
438+
${BUILD_PYTHON} ${ROOT}/generate_metadata.py ${ROOT}/metadata.json
434439
cat ${ROOT}/metadata.json
435440

436441
if [ "${CC}" != "musl-clang" ]; then

0 commit comments

Comments
 (0)