Skip to content

Commit 6738380

Browse files
committed
Add graalpy
1 parent 129380e commit 6738380

File tree

5 files changed

+78
-1
lines changed

5 files changed

+78
-1
lines changed

docker/Dockerfile

+3
Original file line numberDiff line numberDiff line change
@@ -141,12 +141,15 @@ RUN manylinux-entrypoint /build_scripts/build-cpython.sh 3.12.0b4
141141
FROM build_cpython AS all_python
142142
COPY build_scripts/install-pypy.sh \
143143
build_scripts/pypy.sha256 \
144+
build_scripts/install-graalpy.sh \
145+
build_scripts/graalpy.sha256 \
144146
build_scripts/finalize-python.sh \
145147
/build_scripts/
146148
RUN manylinux-entrypoint /build_scripts/install-pypy.sh 3.7 7.3.9
147149
RUN manylinux-entrypoint /build_scripts/install-pypy.sh 3.8 7.3.11
148150
RUN manylinux-entrypoint /build_scripts/install-pypy.sh 3.9 7.3.12
149151
RUN manylinux-entrypoint /build_scripts/install-pypy.sh 3.10 7.3.12
152+
RUN manylinux-entrypoint /build_scripts/install-graalpy.sh 3.10 graal 23.0.0 graalpython
150153
COPY --from=build_cpython36 /opt/_internal /opt/_internal/
151154
COPY --from=build_cpython37 /opt/_internal /opt/_internal/
152155
COPY --from=build_cpython38 /opt/_internal /opt/_internal/

docker/build_scripts/finalize.sh

+3-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ MY_DIR=$(dirname "${BASH_SOURCE[0]}")
1010
source $MY_DIR/build_utils.sh
1111

1212
mkdir /opt/python
13-
for PREFIX in $(find /opt/_internal/ -mindepth 1 -maxdepth 1 \( -name 'cpython*' -o -name 'pypy*' \)); do
13+
for PREFIX in $(find /opt/_internal/ -mindepth 1 -maxdepth 1 \( -name 'cpython*' -o -name 'pypy*' -o -name 'graalpy*' \)); do
1414
# Some python's install as bin/python3. Make them available as
1515
# bin/python.
1616
if [ -e ${PREFIX}/bin/python3 ] && [ ! -e ${PREFIX}/bin/python ]; then
@@ -30,6 +30,8 @@ for PREFIX in $(find /opt/_internal/ -mindepth 1 -maxdepth 1 \( -name 'cpython*'
3030
# Make versioned python commands available directly in environment.
3131
if [[ "${PREFIX}" == *"/pypy"* ]]; then
3232
ln -s ${PREFIX}/bin/python /usr/local/bin/pypy${PY_VER}
33+
elif [[ "${PREFIX}" == *"/graalpy"* ]]; then
34+
ln -s ${PREFIX}/bin/python /usr/local/bin/graalpy${PY_VER}
3335
else
3436
ln -s ${PREFIX}/bin/python /usr/local/bin/python${PY_VER}
3537
fi

docker/build_scripts/graalpy.sha256

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
e2a00b2b6485282b4a04aa382e30d696e00d20eb2fe1736debbe2d9df2a8737a graalpython-23.0.0-linux-aarch64.tar.gz
2+
25e4fa7c1d45db6dcac5bfa4d1a0aa9ef5581623dc5903ce98d246c5d394639c graalpython-23.0.0-linux-amd64.tar.gz
3+
cc40e1d47610c5f4a825a1a7c3ffe8b163c71b5d042d16aebd1a65451d4309a5 graalpython-23.0.0-macos-aarch64.tar.gz
4+
1578902976e6aaf45b9758931f0bddbb29c5c9bdca62c67591d6e153340c2a4f graalpython-23.0.0-macos-amd64.tar.gz
+66
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
#!/bin/bash
2+
3+
# Stop at any error, show all commands
4+
set -exuo pipefail
5+
6+
# Get script directory
7+
MY_DIR=$(dirname "${BASH_SOURCE[0]}")
8+
9+
# Get build utilities
10+
source $MY_DIR/build_utils.sh
11+
12+
if [ "${BASE_POLICY}" == "musllinux" ]; then
13+
echo "Skip GraalPy build on musllinux"
14+
exit 0
15+
fi
16+
17+
PYTHON_VERSION=$1
18+
VERSION_PREFIX=$2
19+
GRAALPY_VERSION=$3
20+
ARCHIVE_PREFIX=$4
21+
GRAALPY_DOWNLOAD_URL=https://github.com/oracle/graalpython/releases/download/${VERSION_PREFIX}-${GRAALPY_VERSION}/
22+
# graal-23.0.0/graalpython-23.0.0-linux-amd64.tar.gz
23+
24+
25+
function get_shortdir {
26+
local exe=$1
27+
$exe -c 'import sys; print(sys.implementation.cache_tag)'
28+
}
29+
30+
31+
mkdir -p /tmp
32+
cd /tmp
33+
34+
case ${AUDITWHEEL_ARCH} in
35+
x86_64) GRAALPY_ARCH=amd64;;
36+
aarch64) GRAALPY_ARCH=aarch64;;
37+
*) echo "No PyPy for ${AUDITWHEEL_ARCH}"; exit 0;;
38+
esac
39+
40+
EXPAND_NAME=graalpy-${GRAALPY_VERSION}-linux-${GRAALPY_ARCH}
41+
TMPDIR=/tmp/${EXPAND_NAME}
42+
TARBALL=graalpython-${GRAALPY_VERSION}-linux-${GRAALPY_ARCH}.tar.gz
43+
PREFIX="/opt/_internal"
44+
45+
mkdir -p ${PREFIX}
46+
47+
fetch_source ${TARBALL} ${GRAALPY_DOWNLOAD_URL}
48+
49+
# We only want to check the current tarball sha256sum
50+
grep " ${TARBALL}\$" ${MY_DIR}/graalpy.sha256 > ${TARBALL}.sha256
51+
# then check sha256 sum
52+
sha256sum -c ${TARBALL}.sha256
53+
54+
tar -xf ${TARBALL}
55+
56+
# rename the directory to something shorter like graalpy230-310
57+
PREFIX=${PREFIX}/$(get_shortdir ${TMPDIR}/bin/graalpy)
58+
mv ${TMPDIR} ${PREFIX}
59+
60+
# add a generic "python" symlink
61+
if [ ! -f "${PREFIX}/bin/python" ]; then
62+
ln -s graalpy ${PREFIX}/bin/python
63+
fi
64+
65+
# We do not need precompiled .pyc and .pyo files.
66+
clean_pyc ${PREFIX}

tests/run_tests.sh

+2
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@ for PYTHON in /opt/python/*/bin/python; do
2828
PYVERS=$(${PYTHON} -c "import sys; print('.'.join(map(str, sys.version_info[:2])))")
2929
if [ "${IMPLEMENTATION}" == "pypy" ]; then
3030
LINK_PREFIX=pypy
31+
elif [ "${IMPLEMENTATION}" == "graalpy" ]; then
32+
LINK_PREFIX=graalpy
3133
else
3234
LINK_PREFIX=python
3335
# Make sure sqlite3 module can be loaded properly and is the manylinux version one

0 commit comments

Comments
 (0)