@@ -27,9 +27,9 @@ if [ "${PY_IMPL}" == "graalpy" ]; then
2727 # GraalPy doesn't update pip/setuptools because it uses a patched version of pip/setuptools
2828 ${PREFIX} /bin/python -m ensurepip --default-pip
2929 ${PREFIX} /bin/python -m pip install -U --require-hashes -r ${MY_DIR} /requirements${PY_VER} .txt
30- elif [ -f /usr/local/bin/python ${PY_VER} ]; then
30+ elif [ -f /usr/local/bin/cpython ${PY_VER} ]; then
3131 # Use the already intsalled cpython pip to bootstrap pip if available
32- /usr/local/bin/python ${PY_VER} -m pip --python ${PREFIX} /bin/python install -U --require-hashes -r ${MY_DIR} /requirements${PY_VER} .txt
32+ /usr/local/bin/cpython ${PY_VER} -m pip --python ${PREFIX} /bin/python install -U --require-hashes -r ${MY_DIR} /requirements${PY_VER} .txt
3333else
3434 ${PREFIX} /bin/python -m ensurepip
3535 ${PREFIX} /bin/python -m pip install -U --require-hashes -r ${MY_DIR} /requirements${PY_VER} .txt
4040# Create a symlink to PREFIX using the ABI_TAG in /opt/python/
4141ABI_TAG=$( ${PREFIX} /bin/python ${MY_DIR} /python-tag-abi-tag.py)
4242ln -s ${PREFIX} /opt/python/${ABI_TAG}
43+
4344# Make versioned python commands available directly in environment.
45+ # Don't use symlinks: c.f. https://github.com/python/cpython/issues/106045
46+ cat << EOF > /usr/local/bin/${PY_IMPL}${PY_VER}${PY_GIL}
47+ #!/bin/sh
48+ exec /opt/python/${ABI_TAG} /bin/python "\$ @"
49+ EOF
50+ chmod +x /usr/local/bin/${PY_IMPL}${PY_VER}${PY_GIL}
4451if [[ " ${PY_IMPL} " == " cpython" ]]; then
45- ln -s ${PREFIX} /bin/python /usr/local/bin/python${PY_VER}${PY_GIL}
52+ ln -s ${PY_IMPL}${PY_VER}${PY_GIL} /usr/local/bin/python${PY_VER}${PY_GIL}
4653fi
47- ln -s ${PREFIX} /bin/python /usr/local/bin/${PY_IMPL}${PY_VER}${PY_GIL}
0 commit comments