Skip to content

Commit

Permalink
Instead of installing graalpy in the base image, install an installat…
Browse files Browse the repository at this point in the history
…ion script
  • Loading branch information
timfel committed Jul 23, 2023
1 parent 5ade26b commit b3b21d5
Show file tree
Hide file tree
Showing 4 changed files with 42 additions and 2 deletions.
3 changes: 2 additions & 1 deletion docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -142,14 +142,15 @@ FROM build_cpython AS all_python
COPY build_scripts/install-pypy.sh \
build_scripts/pypy.sha256 \
build_scripts/install-graalpy.sh \
build_scripts/install-graalpy-install-script.sh \
build_scripts/graalpy.sha256 \
build_scripts/finalize-python.sh \
/build_scripts/
RUN manylinux-entrypoint /build_scripts/install-pypy.sh 3.7 7.3.9
RUN manylinux-entrypoint /build_scripts/install-pypy.sh 3.8 7.3.11
RUN manylinux-entrypoint /build_scripts/install-pypy.sh 3.9 7.3.12
RUN manylinux-entrypoint /build_scripts/install-pypy.sh 3.10 7.3.12
RUN manylinux-entrypoint /build_scripts/install-graalpy.sh 3.10 graal 23.0.0 graalpython
RUN manylinux-entrypoint /build_scripts/install-graalpy-install-script.sh 3.10 graal 23.0.0 graalpython
COPY --from=build_cpython36 /opt/_internal /opt/_internal/
COPY --from=build_cpython37 /opt/_internal /opt/_internal/
COPY --from=build_cpython38 /opt/_internal /opt/_internal/
Expand Down
30 changes: 30 additions & 0 deletions docker/build_scripts/install-graalpy-install-script.sh
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]}")

# Get build utilities
source $MY_DIR/build_utils.sh

if [ "${BASE_POLICY}" == "musllinux" ]; then
echo "Skip GraalPy build on musllinux"
exit 0
fi

case ${AUDITWHEEL_ARCH} in
x86_64) ;;
aarch64) ;;
*) echo "No GraalPy for ${AUDITWHEEL_ARCH}"; exit 0;;
esac

PREFIX="/opt/_internal/install-graalpy"
mkdir -p ${PREFIX}

cp -R $MY_DIR/* ${PREFIX}/
cat <<EOF> /usr/local/bin/install-graalpy.sh
${PREFIX}/install-graalpy.sh $@
EOF
chmod +x /usr/local/bin/install-graalpy.sh
8 changes: 7 additions & 1 deletion docker/build_scripts/install-graalpy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ cd /tmp
case ${AUDITWHEEL_ARCH} in
x86_64) GRAALPY_ARCH=amd64;;
aarch64) GRAALPY_ARCH=aarch64;;
*) echo "No PyPy for ${AUDITWHEEL_ARCH}"; exit 0;;
*) echo "No GraalPy for ${AUDITWHEEL_ARCH}"; exit 0;;
esac

EXPAND_NAME=graalpy-${GRAALPY_VERSION}-linux-${GRAALPY_ARCH}
Expand Down Expand Up @@ -64,3 +64,9 @@ fi

# We do not need precompiled .pyc and .pyo files.
clean_pyc ${PREFIX}

# We currently do not run this script as part of the normal manylinux image
# build, but later as part of a user's manylinux run, we immediately finalize
# the graalpy environment. If we switch to providing GraalPy in the base image,
# this line can go away.
$MY_DIR/finalize-python-prefix.sh ${PREFIX}
3 changes: 3 additions & 0 deletions tests/run_tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ else
exit 1
fi

# GraalPy is not provided in the image directly, only an installer script. Run it so
# we test GraalPy as well.
/usr/local/bin/install-graalpy.sh

for PYTHON in /opt/python/*/bin/python; do
# Smoke test to make sure that our Pythons work, and do indeed detect as
Expand Down

0 comments on commit b3b21d5

Please sign in to comment.