From d1fc534ed65a9acc2136a6eab3148ed5f180790d Mon Sep 17 00:00:00 2001 From: mayeut Date: Sun, 13 Aug 2023 22:07:33 +0200 Subject: [PATCH] feature: add GraalPy --- docker/build_scripts/manylinux-python.py | 8 ++++++++ docker/build_scripts/python-tag-abi-tag.py | 9 ++++++++- docker/build_scripts/python_versions.json | 14 ++++++++++++++ tests/run_tests.sh | 15 ++++++++++----- 4 files changed, 40 insertions(+), 6 deletions(-) diff --git a/docker/build_scripts/manylinux-python.py b/docker/build_scripts/manylinux-python.py index c2778994..61387974 100644 --- a/docker/build_scripts/manylinux-python.py +++ b/docker/build_scripts/manylinux-python.py @@ -21,6 +21,8 @@ def sort_key(tag): python_tag, _ = tag.split("-") if python_tag.startswith(("cp", "pp")): return python_tag[:2], int(python_tag[2]), int(python_tag[3:]) + if python_tag.startswith("graalpy"): + return python_tag[:7], int(python_tag[7]), int(python_tag[8:]) raise LookupError(tag) @@ -81,6 +83,12 @@ def get_info_from_tag(tag): "i": "pypy", "iv": PYTHON_TAGS[tag][ARCH]["version"] } + if python_tag.startswith("graalpy"): + return { + "pv": f"{python_tag[7]}.{python_tag[8:]}", + "i": "graalpy", + "iv": PYTHON_TAGS[tag][ARCH]["version"] + } raise LookupError(tag) diff --git a/docker/build_scripts/python-tag-abi-tag.py b/docker/build_scripts/python-tag-abi-tag.py index c3ce1f11..6ac6be6c 100644 --- a/docker/build_scripts/python-tag-abi-tag.py +++ b/docker/build_scripts/python-tag-abi-tag.py @@ -2,9 +2,16 @@ # See PEP 425 for exactly what these are, but an example would be: # cp27-cp27mu -from packaging.tags import sys_tags +from packaging.tags import sys_tags, Tag +from wheel.bdist_wheel import get_abi_tag # first tag is always the more specific tag tag = next(sys_tags()) + +# there are some inconsistencies so check against wheel +wheel_abi_tag = get_abi_tag() +if tag.abi != wheel_abi_tag: + assert tag.interpreter.startswith("graalpy") + tag = Tag(tag.interpreter, wheel_abi_tag, tag.platform) print("{0}-{1}".format(tag.interpreter, tag.abi)) diff --git a/docker/build_scripts/python_versions.json b/docker/build_scripts/python_versions.json index dee55804..4df3814a 100644 --- a/docker/build_scripts/python_versions.json +++ b/docker/build_scripts/python_versions.json @@ -1,4 +1,18 @@ { + "graalpy310-graalpy230_310_native_x86_64_linux": { + "x86_64": { + "version": "23.0.0", + "download_url": "https://github.com/oracle/graalpython/releases/download/graal-23.0.0/graalpython-23.0.0-linux-amd64.tar.gz", + "sha256": "25e4fa7c1d45db6dcac5bfa4d1a0aa9ef5581623dc5903ce98d246c5d394639c" + } + }, + "graalpy310-graalpy230_310_native_aarch64_linux": { + "aarch64": { + "version": "23.0.0", + "download_url": "https://github.com/oracle/graalpython/releases/download/graal-23.0.0/graalpython-23.0.0-linux-aarch64.tar.gz", + "sha256": "e2a00b2b6485282b4a04aa382e30d696e00d20eb2fe1736debbe2d9df2a8737a" + } + }, "pp37-pypy37_pp73": { "x86_64": { "version": "7.3.9", diff --git a/tests/run_tests.sh b/tests/run_tests.sh index c55e0a56..e00659c0 100755 --- a/tests/run_tests.sh +++ b/tests/run_tests.sh @@ -21,7 +21,10 @@ if [ "${AUDITWHEEL_POLICY:0:10}" == "musllinux_" ]; then EXPECTED_PYTHON_COUNT=7 EXPECTED_PYTHON_COUNT_ALL=7 else - if [ "${AUDITWHEEL_ARCH}" == "x86_64" ] || [ "${AUDITWHEEL_ARCH}" == "i686" ] || [ "${AUDITWHEEL_ARCH}" == "aarch64" ]; then + if [ "${AUDITWHEEL_ARCH}" == "x86_64" ] || [ "${AUDITWHEEL_ARCH}" == "aarch64" ]; then + EXPECTED_PYTHON_COUNT=11 + EXPECTED_PYTHON_COUNT_ALL=12 + elif [ "${AUDITWHEEL_ARCH}" == "i686" ]; then EXPECTED_PYTHON_COUNT=11 EXPECTED_PYTHON_COUNT_ALL=11 else @@ -91,10 +94,12 @@ for PYTHON in /opt/python/*/bin/python; do echo "invalid repaired wheel name" exit 1 fi - ${PYTHON} -m pip install ${REPAIRED_WHEEL} - if [ "$(${PYTHON} -c 'import forty_two; print(forty_two.answer())')" != "42" ]; then - echo "invalid answer, expecting 42" - exit 1 + if [ "${IMPLEMENTATION}" != "graalpy" ]; then + ${PYTHON} -m pip install ${REPAIRED_WHEEL} + if [ "$(${PYTHON} -c 'import forty_two; print(forty_two.answer())')" != "42" ]; then + echo "invalid answer, expecting 42" + exit 1 + fi fi PYTHON_COUNT=$(( $PYTHON_COUNT + 1 ))