-
Notifications
You must be signed in to change notification settings - Fork 218
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
PyPy installation is just a tar extract. As such, it might be interesting to install PyPy at runtime rather than at build time. This is especially true for EOL versions of PyPy which would allow to reduce the image size, and thus, overall build time for users not using EOL PyPy versions. This commit does not modify default installed PyPy versions yet. This commit will also be useful for GraalPy installation.
- Loading branch information
Showing
13 changed files
with
555 additions
and
184 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
#!/bin/bash | ||
|
||
# Stop at any error, show all commands | ||
set -exuo pipefail | ||
|
||
# Get script directory | ||
MY_DIR=$(dirname "${BASH_SOURCE[0]}") | ||
|
||
ABI_TAG=$1 | ||
DOWNLOAD_URL=$2 | ||
SHA256=$3 | ||
|
||
PREFIX="/opt/_internal/${ABI_TAG}" | ||
|
||
case ${DOWNLOAD_URL} in | ||
*.tar) COMP=;; | ||
*.tar.gz) COMP=z;; | ||
*.tar.bz2) COMP=j;; | ||
*.tar.xz) COMP=J;; | ||
*) echo "unsupported archive"; exit 1;; | ||
esac | ||
|
||
mkdir ${PREFIX} | ||
|
||
curl -fsSL ${DOWNLOAD_URL} | tee >(tar -C ${PREFIX} --strip-components 1 -x${COMP}f -) | sha256sum -c <(echo "${SHA256} -") | ||
|
||
# remove debug symbols if any | ||
find ${PREFIX}/bin -name '*.debug' -delete | ||
|
||
${MY_DIR}/finalize-one.sh ${PREFIX} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
#!/bin/bash | ||
|
||
# Stop at any error, show all commands | ||
set -exuo pipefail | ||
|
||
PREFIX=$1 | ||
|
||
# Get script directory | ||
MY_DIR=$(dirname "${BASH_SOURCE[0]}") | ||
|
||
# Some python's install as bin/python3. Make them available as | ||
# bin/python. | ||
if [ -e ${PREFIX}/bin/python3 ] && [ ! -e ${PREFIX}/bin/python ]; then | ||
ln -s python3 ${PREFIX}/bin/python | ||
fi | ||
PY_VER=$(${PREFIX}/bin/python -c "import sys; print('.'.join(str(v) for v in sys.version_info[:2]))") | ||
PY_IMPL=$(${PREFIX}/bin/python -c "import sys; print(sys.implementation.name)") | ||
|
||
# Install pinned packages for this python version. | ||
# Use the already intsalled cpython pip to bootstrap pip if available | ||
if [ -f /usr/local/bin/python${PY_VER} ]; then | ||
/usr/local/bin/python${PY_VER} -m pip --python ${PREFIX}/bin/python install -U --require-hashes -r ${MY_DIR}/requirements${PY_VER}.txt | ||
else | ||
${PREFIX}/bin/python -m ensurepip | ||
${PREFIX}/bin/python -m pip install -U --require-hashes -r ${MY_DIR}/requirements${PY_VER}.txt | ||
fi | ||
if [ -e ${PREFIX}/bin/pip3 ] && [ ! -e ${PREFIX}/bin/pip ]; then | ||
ln -s pip3 ${PREFIX}/bin/pip | ||
fi | ||
# Create a symlink to PREFIX using the ABI_TAG in /opt/python/ | ||
ABI_TAG=$(${PREFIX}/bin/python ${MY_DIR}/python-tag-abi-tag.py) | ||
ln -s ${PREFIX} /opt/python/${ABI_TAG} | ||
# Make versioned python commands available directly in environment. | ||
if [[ "${PY_IMPL}" == "cpython" ]]; then | ||
ln -s ${PREFIX}/bin/python /usr/local/bin/python${PY_VER} | ||
fi | ||
ln -s ${PREFIX}/bin/python /usr/local/bin/${PY_IMPL}${PY_VER} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.