From 3bf05d4b5514a80e2313c6e86ed1e0311d85464c Mon Sep 17 00:00:00 2001 From: Matthieu Darbois Date: Sat, 21 Sep 2024 20:13:43 +0200 Subject: [PATCH] feature: add musllinux_1_2_armv7l (#1455) --- .travis.yml | 4 ++++ README.rst | 1 + build.sh | 3 +++ docker/build_scripts/build-cpython.sh | 6 +++++- docker/build_scripts/finalize.sh | 10 ++++++---- docker/manylinux-entrypoint | 5 +++++ tests/run_tests.sh | 3 ++- 7 files changed, 26 insertions(+), 6 deletions(-) diff --git a/.travis.yml b/.travis.yml index 511d7af2f..d16ff6a4b 100644 --- a/.travis.yml +++ b/.travis.yml @@ -57,6 +57,10 @@ jobs: virt: vm group: edge env: POLICY="musllinux_1_2" PLATFORM="aarch64" + - arch: arm64-graviton2 + virt: vm + group: edge + env: POLICY="musllinux_1_2" PLATFORM="armv7l" - arch: s390x env: POLICY="musllinux_1_2" PLATFORM="s390x" - arch: ppc64le diff --git a/README.rst b/README.rst index f1b35a36b..ea82f4d33 100644 --- a/README.rst +++ b/README.rst @@ -184,6 +184,7 @@ Toolchain: GCC 13 - aarch64 image: ``quay.io/pypa/musllinux_1_2_aarch64`` - ppc64le image: ``quay.io/pypa/musllinux_1_2_ppc64le`` - s390x image: ``quay.io/pypa/musllinux_1_2_s390x`` +- armv7l image: ``quay.io/pypa/musllinux_1_2_armv7l`` musllinux_1_1 (Alpine Linux 2.12 based) diff --git a/build.sh b/build.sh index e663cceeb..ccc5d5933 100755 --- a/build.sh +++ b/build.sh @@ -27,6 +27,9 @@ elif [ "${PLATFORM}" == "ppc64le" ]; then elif [ "${PLATFORM}" == "s390x" ]; then GOARCH="s390x" MULTIARCH_PREFIX="s390x/" +elif [ "${PLATFORM}" == "armv7l" ]; then + GOARCH="arm/v7" + MULTIARCH_PREFIX="arm32v7/" else echo "Unsupported platform: '${PLATFORM}'" exit 1 diff --git a/docker/build_scripts/build-cpython.sh b/docker/build_scripts/build-cpython.sh index ea7485a9b..0eae0e626 100755 --- a/docker/build_scripts/build-cpython.sh +++ b/docker/build_scripts/build-cpython.sh @@ -46,10 +46,14 @@ if [ "${CPYTHON_VERSION}" == "3.6.15" ]; then CFLAGS_EXTRA="${CFLAGS_EXTRA} -fno-tree-loop-vectorize -fno-tree-slp-vectorize" fi if [ "${AUDITWHEEL_POLICY}" == "manylinux2014" ] ; then - # Python 3.11+ + # Python 3.11+ export TCLTK_LIBS="-ltk8.6 -ltcl8.6" fi +if [ "${BASE_POLICY}_${AUDITWHEEL_ARCH}" == "musllinux_armv7l" ]; then + CONFIGURE_ARGS="${CONFIGURE_ARGS} --build=arm-linux-musleabihf" +fi + OPENSSL_PREFIX=$(find /opt/_internal -maxdepth 1 -name 'openssl*') if [ "${OPENSSL_PREFIX}" != "" ]; then CONFIGURE_ARGS="${CONFIGURE_ARGS} --with-openssl=${OPENSSL_PREFIX}" diff --git a/docker/build_scripts/finalize.sh b/docker/build_scripts/finalize.sh index b266f68e2..8d7bd60e8 100755 --- a/docker/build_scripts/finalize.sh +++ b/docker/build_scripts/finalize.sh @@ -80,10 +80,12 @@ pipx upgrade-shared --pip-args="--no-index --find-links=/tmp/pinned-wheels" # install other tools with pipx for TOOL_PATH in $(find ${MY_DIR}/requirements-tools -type f); do TOOL=$(basename ${TOOL_PATH}) - # uv doesn't provide musl s390x wheels due to Rust issues - if [[ "${TOOL}" != "uv" || "${BASE_POLICY}-${AUDITWHEEL_ARCH}" != "musllinux-s390x" ]]; then - pipx install --pip-args="--require-hashes -r ${TOOL_PATH} --only-binary" ${TOOL} - fi + case ${AUDITWHEEL_PLAT}-${TOOL} in + musllinux*_armv7l-swig) apk add --no-cache swig;; + musllinux*_armv7l-cmake) apk add --no-cache cmake;; + musllinux*_s390x-uv) continue;; # uv doesn't provide musl s390x wheels due to Rust issues + *) pipx install --pip-args="--require-hashes -r ${TOOL_PATH} --only-binary" ${TOOL};; + esac done # We do not need the precompiled .pyc and .pyo files. diff --git a/docker/manylinux-entrypoint b/docker/manylinux-entrypoint index 973f1e600..bbe06c0ac 100755 --- a/docker/manylinux-entrypoint +++ b/docker/manylinux-entrypoint @@ -4,6 +4,11 @@ set -eu if [ "${AUDITWHEEL_ARCH}" == "i686" ] && [ "$(uname -m)" == "x86_64" ]; then linux32 "$@" +elif [ "${AUDITWHEEL_ARCH}" == "armv7l" ] && [ "$(uname -m)" != "armv7l" ]; then + if [ "$(linux32 uname -m)" == "armv8l" ]; then + export _PYTHON_HOST_PLATFORM="linux_armv7l" + fi + linux32 "$@" else exec "$@" fi diff --git a/tests/run_tests.sh b/tests/run_tests.sh index b1777b95a..61bdf85af 100755 --- a/tests/run_tests.sh +++ b/tests/run_tests.sh @@ -100,8 +100,9 @@ for PYTHON in /opt/python/*/bin/python; do echo "invalid answer, expecting 42" exit 1 fi - if [ "${PYVERS}" != "3.6" ] && [ "${PYVERS}" != "3.7" ] && [ "${IMPLEMENTATION}" != "graalpy" ] && [ "${AUDITWHEEL_POLICY:0:9}_${AUDITWHEEL_ARCH}" != "musllinux_s390x" ] && [ "${AUDITWHEEL_ARCH}" != "ppc64le" ]; then + if [ "${PYVERS}" != "3.6" ] && [ "${PYVERS}" != "3.7" ] && [ "${IMPLEMENTATION}" != "graalpy" ] && [ "${AUDITWHEEL_POLICY:0:9}_${AUDITWHEEL_ARCH}" != "musllinux_s390x" ] && [ "${AUDITWHEEL_ARCH}" != "ppc64le" ] && [ "${AUDITWHEEL_ARCH}" != "armv7l" ]; then # no uv on musllinux s390x + # FIXME, armv7l test fails on Travis CI but works with qemu (maybe armv8l vs armv7l ?) # FIXME, ppc64le test fails on Travis CI but works with qemu UV_PYTHON=/tmp/uv-test-${IMPLEMENTATION}${PYVERS}/bin/python uv venv --python ${PYTHON} /tmp/uv-test-${IMPLEMENTATION}${PYVERS}