From 7506207332549c48ab102e7a813d350fe8fb05c1 Mon Sep 17 00:00:00 2001 From: Franck Nijhof Date: Tue, 8 Oct 2024 13:46:52 +0200 Subject: [PATCH 1/4] Add Python 3.13 --- README.md | 10 +-- python/3.13/Dockerfile | 131 ++++++++++++++++++++++++++++ python/3.13/build.yaml | 17 ++++ python/3.13/musl-find_library.patch | 45 ++++++++++ 4 files changed, 198 insertions(+), 5 deletions(-) create mode 100644 python/3.13/Dockerfile create mode 100644 python/3.13/build.yaml create mode 100644 python/3.13/musl-find_library.patch diff --git a/README.md b/README.md index 56ce7a3..c23ad9e 100644 --- a/README.md +++ b/README.md @@ -29,11 +29,11 @@ We support the latest 3 release with the latest 3 Alpine version. | Image | OS | Tags | latest | |-------|----|------|--------| -| armhf-base-python | Alpine | 3.10, 3.11, 3.12, 3.10-alpine3.18, 3.10-alpine3.19, 3.10-alpine3.20, 3.11-alpine3.18, 3.11-alpine3.19, 3.11-alpine3.20, 3.12-alpine3.18, 3.12-alpine3.19, 3.12-alpine3.20 | 3.12-alpine3.20 | -| armv7-base-python | Alpine | 3.10, 3.11, 3.12, 3.10-alpine3.18, 3.10-alpine3.19, 3.10-alpine3.20, 3.11-alpine3.18, 3.11-alpine3.19, 3.11-alpine3.20, 3.12-alpine3.18, 3.12-alpine3.19, 3.12-alpine3.20 | 3.12-alpine3.20 | -| aarch64-base-python | Alpine | 3.10, 3.11, 3.12, 3.10-alpine3.18, 3.10-alpine3.19, 3.10-alpine3.20, 3.11-alpine3.18, 3.11-alpine3.19, 3.11-alpine3.20, 3.12-alpine3.18, 3.12-alpine3.19, 3.12-alpine3.20 | 3.12-alpine3.20 | -| amd64-base-python | Alpine | 3.10, 3.11, 3.12, 3.10-alpine3.18, 3.10-alpine3.19, 3.10-alpine3.20, 3.11-alpine3.18, 3.11-alpine3.19, 3.11-alpine3.20, 3.12-alpine3.18, 3.12-alpine3.19, 3.12-alpine3.20 | 3.12-alpine3.20 | -| i386-base-python | Alpine | 3.10, 3.11, 3.12, 3.10-alpine3.18, 3.10-alpine3.19, 3.10-alpine3.20, 3.11-alpine3.18, 3.11-alpine3.19, 3.11-alpine3.20, 3.12-alpine3.18, 3.12-alpine3.19, 3.12-alpine3.20 | 3.12-alpine3.20 | +| armhf-base-python | Alpine | 3.11, 3.12, 3.13, 3.11-alpine3.18, 3.11-alpine3.19, 3.11-alpine3.20, 3.12-alpine3.18, 3.12-alpine3.19, 3.12-alpine3.20, 3.13-alpine3.18, 3.13-alpine3.19, 3.13-alpine3.20 | 3.13-alpine3.20 | +| armv7-base-python | Alpine | 3.11, 3.12, 3.13, 3.11-alpine3.18, 3.11-alpine3.19, 3.11-alpine3.20, 3.12-alpine3.18, 3.12-alpine3.19, 3.12-alpine3.20, 3.13-alpine3.18, 3.13-alpine3.19, 3.13-alpine3.20 | 3.13-alpine3.20 | +| aarch64-base-python | Alpine | 3.11, 3.12, 3.13, 3.11-alpine3.18, 3.11-alpine3.19, 3.11-alpine3.20, 3.12-alpine3.18, 3.12-alpine3.19, 3.12-alpine3.20, 3.13-alpine3.18, 3.13-alpine3.19, 3.13-alpine3.20 | 3.13-alpine3.20 | +| amd64-base-python | Alpine | 3.11, 3.12, 3.13, 3.11-alpine3.18, 3.11-alpine3.19, 3.11-alpine3.20, 3.12-alpine3.18, 3.12-alpine3.19, 3.12-alpine3.20, 3.13-alpine3.18, 3.13-alpine3.19, 3.13-alpine3.20 | 3.13-alpine3.20 | +| i386-base-python | Alpine | 3.11, 3.12, 3.13, 3.11-alpine3.18, 3.11-alpine3.19, 3.11-alpine3.20, 3.12-alpine3.18, 3.12-alpine3.19, 3.12-alpine3.20, 3.13-alpine3.18, 3.13-alpine3.19, 3.13-alpine3.20 | 3.13-alpine3.20 | ## Others diff --git a/python/3.13/Dockerfile b/python/3.13/Dockerfile new file mode 100644 index 0000000..a209429 --- /dev/null +++ b/python/3.13/Dockerfile @@ -0,0 +1,131 @@ +ARG BUILD_FROM +FROM $BUILD_FROM + +ARG \ + PYTHON_VERSION \ + PIP_VERSION \ + GPG_KEY \ + QEMU_CPU + +# ensure local python is preferred over distribution python +ENV PATH /usr/local/bin:$PATH + +# Set shell +SHELL ["/bin/ash", "-o", "pipefail", "-c"] + +COPY *.patch /usr/src/ +RUN set -ex \ + && export PYTHON_VERSION=${PYTHON_VERSION} \ + && apk add --no-cache --virtual .fetch-deps \ + gnupg \ + openssl \ + tar \ + xz \ + \ + && curl -L -o python.tar.xz "https://www.python.org/ftp/python/${PYTHON_VERSION%%[a-z]*}/Python-$PYTHON_VERSION.tar.xz" \ + && curl -L -o python.tar.xz.asc "https://www.python.org/ftp/python/${PYTHON_VERSION%%[a-z]*}/Python-$PYTHON_VERSION.tar.xz.asc" \ + && export GNUPGHOME="$(mktemp -d)" \ + && echo "disable-ipv6" >> "$GNUPGHOME/dirmngr.conf" \ + && gpg --batch --keyserver hkps://keys.openpgp.org --recv-keys "${GPG_KEY}" \ + && gpg --batch --verify python.tar.xz.asc python.tar.xz \ + && { command -v gpgconf > /dev/null && gpgconf --kill all || :; } \ + && rm -rf "$GNUPGHOME" python.tar.xz.asc \ + && mkdir -p /usr/src/python \ + && tar -xJC /usr/src/python --strip-components=1 -f python.tar.xz \ + && rm python.tar.xz \ + \ + && apk add --no-cache --virtual .build-deps \ + patch \ + bzip2-dev \ + coreutils \ + dpkg-dev dpkg \ + expat-dev \ + findutils \ + build-base \ + gdbm-dev \ + libc-dev \ + libffi-dev \ + libnsl-dev \ + openssl \ + openssl-dev \ + libtirpc-dev \ + linux-headers \ + make \ + mpdecimal-dev \ + ncurses-dev \ + pax-utils \ + readline-dev \ + sqlite-dev \ + tcl-dev \ + tk \ + tk-dev \ + xz-dev \ + zlib-dev \ + bluez-dev \ + # add build deps before removing fetch deps in case there's overlap + && apk del .fetch-deps \ + \ + && for i in /usr/src/*.patch; do \ + patch -d /usr/src/python -p 1 < "${i}"; done \ + && cd /usr/src/python \ + && gnuArch="$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)" \ + && ./configure \ + --build="$gnuArch" \ + --enable-loadable-sqlite-extensions \ + --enable-optimizations \ + --enable-option-checking=fatal \ + --enable-shared \ + --with-lto \ + --with-system-libmpdec \ + --with-system-expat \ + --without-ensurepip \ + --without-static-libpython \ + && make -j "$(nproc)" \ + LDFLAGS="-Wl,--strip-all" \ + CFLAGS="-fno-semantic-interposition -fno-builtin-malloc -fno-builtin-calloc -fno-builtin-realloc -fno-builtin-free" \ +# set thread stack size to 1MB so we don't segfault before we hit sys.getrecursionlimit() +# https://github.com/alpinelinux/aports/commit/2026e1259422d4e0cf92391ca2d3844356c649d0 + EXTRA_CFLAGS="-DTHREAD_STACK_SIZE=0x100000" \ + && make install \ + \ + && find /usr/local -type f -executable -not \( -name '*tkinter*' \) -exec scanelf --needed --nobanner --format '%n#p' '{}' ';' \ + | tr ',' '\n' \ + | sort -u \ + | awk 'system("[ -e /usr/local/lib/" $1 " ]") == 0 { next } { print "so:" $1 }' \ + | xargs -rt apk add --no-cache --virtual .python-rundeps \ + && apk del .build-deps \ + \ + && find /usr/local -depth \ + \( \ + -type d -a \( -name test -o -name tests \) \ + \) -exec rm -rf '{}' + \ + && rm -rf /usr/src/python \ + && rm -f /usr/src/*.patch + +# make some useful symlinks that are expected to exist +RUN cd /usr/local/bin \ + && ln -s idle3 idle \ + && ln -s pydoc3 pydoc \ + && ln -s python3 python \ + && ln -s python3-config python-config + +RUN set -ex; \ + \ + apk add --no-cache --virtual .fetch-deps openssl; \ + \ + curl -L -o get-pip.py 'https://bootstrap.pypa.io/get-pip.py'; \ + \ + apk del .fetch-deps; \ + \ + python get-pip.py \ + --disable-pip-version-check \ + --no-cache-dir \ + pip==${PIP_VERSION} \ + ; \ + pip --version; \ + \ + find /usr/local -depth \ + \( \ + -type d -a \( -name test -o -name tests \) \ + \) -exec rm -rf '{}' +; \ + rm -f get-pip.py diff --git a/python/3.13/build.yaml b/python/3.13/build.yaml new file mode 100644 index 0000000..b91e5c7 --- /dev/null +++ b/python/3.13/build.yaml @@ -0,0 +1,17 @@ +image: ghcr.io/home-assistant/{arch}-base-python +build_from: + aarch64: "ghcr.io/home-assistant/aarch64-base:" + armv7: "ghcr.io/home-assistant/armv7-base:" + armhf: "ghcr.io/home-assistant/armhf-base:" + amd64: "ghcr.io/home-assistant/amd64-base:" + i386: "ghcr.io/home-assistant/i386-base:" +cosign: + base_identity: https://github.com/home-assistant/docker-base/.* + identity: https://github.com/home-assistant/docker-base/.* +args: + PYTHON_VERSION: 3.13.0 + PIP_VERSION: 24.2 + GPG_KEY: 7169605F62C751356D054A26A821E680E5FA6305 +labels: + io.hass.base.name: python + org.opencontainers.image.source: https://github.com/home-assistant/docker-base diff --git a/python/3.13/musl-find_library.patch b/python/3.13/musl-find_library.patch new file mode 100644 index 0000000..7899abb --- /dev/null +++ b/python/3.13/musl-find_library.patch @@ -0,0 +1,45 @@ +diff -ru Python-2.7.12.orig/Lib/ctypes/util.py Python-2.7.12/Lib/ctypes/util.py +--- Python-2.7.12.orig/Lib/ctypes/util.py 2016-06-26 00:49:30.000000000 +0300 ++++ Python-2.7.12/Lib/ctypes/util.py 2016-11-03 16:05:46.954665040 +0200 +@@ -204,6 +204,41 @@ + def find_library(name, is64 = False): + return _get_soname(_findLib_crle(name, is64) or _findLib_gcc(name)) + ++ elif True: ++ ++ # Patched for Alpine Linux / musl - search manually system paths ++ def _is_elf(filepath): ++ try: ++ with open(filepath, 'rb') as fh: ++ return fh.read(4) == b'\x7fELF' ++ except: ++ return False ++ ++ def find_library(name): ++ from glob import glob ++ # absolute name? ++ if os.path.isabs(name): ++ return name ++ # special case for libm, libcrypt and libpthread and musl ++ if name in ['m', 'crypt', 'pthread']: ++ name = 'c' ++ elif name in ['libm.so', 'libcrypt.so', 'libpthread.so']: ++ name = 'libc.so' ++ # search in standard locations (musl order) ++ paths = ['/lib', '/usr/local/lib', '/usr/lib'] ++ if 'LD_LIBRARY_PATH' in os.environ: ++ paths = os.environ['LD_LIBRARY_PATH'].split(':') + paths ++ for d in paths: ++ f = os.path.join(d, name) ++ if _is_elf(f): ++ return os.path.basename(f) ++ ++ prefix = os.path.join(d, 'lib'+name) ++ for suffix in ['.so', '.so.*']: ++ for f in glob('{0}{1}'.format(prefix, suffix)): ++ if _is_elf(f): ++ return os.path.basename(f) ++ + else: + + def _findSoname_ldconfig(name): From 28f6e8c6730ead857be01b7d76349d3de840dfc5 Mon Sep 17 00:00:00 2001 From: Franck Nijhof Date: Tue, 8 Oct 2024 13:47:03 +0200 Subject: [PATCH 2/4] Drop Python 3.10 support --- python/3.10/Dockerfile | 132 ------------------------- python/3.10/arm-alignment.patch | 17 ---- python/3.10/asynctio_unix_events.patch | 16 --- python/3.10/build.yaml | 17 ---- python/3.10/fix-xattrs-glibc.patch | 16 --- python/3.10/musl-find_library.patch | 45 --------- 6 files changed, 243 deletions(-) delete mode 100644 python/3.10/Dockerfile delete mode 100644 python/3.10/arm-alignment.patch delete mode 100644 python/3.10/asynctio_unix_events.patch delete mode 100644 python/3.10/build.yaml delete mode 100644 python/3.10/fix-xattrs-glibc.patch delete mode 100644 python/3.10/musl-find_library.patch diff --git a/python/3.10/Dockerfile b/python/3.10/Dockerfile deleted file mode 100644 index 97eb7f9..0000000 --- a/python/3.10/Dockerfile +++ /dev/null @@ -1,132 +0,0 @@ -ARG BUILD_FROM -FROM $BUILD_FROM - -ARG \ - PYTHON_VERSION \ - PIP_VERSION \ - GPG_KEY \ - QEMU_CPU - -# ensure local python is preferred over distribution python -ENV PATH /usr/local/bin:$PATH - -# Set shell -SHELL ["/bin/ash", "-o", "pipefail", "-c"] - -COPY *.patch /usr/src/ -RUN set -ex \ - && export PYTHON_VERSION=${PYTHON_VERSION} \ - && apk add --no-cache --virtual .fetch-deps \ - gnupg \ - openssl \ - tar \ - xz \ - \ - && curl -L -o python.tar.xz "https://www.python.org/ftp/python/${PYTHON_VERSION%%[a-z]*}/Python-$PYTHON_VERSION.tar.xz" \ - && curl -L -o python.tar.xz.asc "https://www.python.org/ftp/python/${PYTHON_VERSION%%[a-z]*}/Python-$PYTHON_VERSION.tar.xz.asc" \ - && export GNUPGHOME="$(mktemp -d)" \ - && echo "disable-ipv6" >> "$GNUPGHOME/dirmngr.conf" \ - && gpg --batch --keyserver hkps://keys.openpgp.org --recv-keys "${GPG_KEY}" \ - && gpg --batch --verify python.tar.xz.asc python.tar.xz \ - && { command -v gpgconf > /dev/null && gpgconf --kill all || :; } \ - && rm -rf "$GNUPGHOME" python.tar.xz.asc \ - && mkdir -p /usr/src/python \ - && tar -xJC /usr/src/python --strip-components=1 -f python.tar.xz \ - && rm python.tar.xz \ - \ - && apk add --no-cache --virtual .build-deps \ - patch \ - bzip2-dev \ - coreutils \ - dpkg-dev dpkg \ - expat-dev \ - findutils \ - build-base \ - gdbm-dev \ - libc-dev \ - libffi-dev \ - libnsl-dev \ - openssl \ - openssl-dev \ - libtirpc-dev \ - linux-headers \ - make \ - mpdecimal-dev \ - ncurses-dev \ - pax-utils \ - readline-dev \ - sqlite-dev \ - tcl-dev \ - tk \ - tk-dev \ - xz-dev \ - zlib-dev \ - bluez-dev \ -# add build deps before removing fetch deps in case there's overlap - && apk del .fetch-deps \ - \ - && for i in /usr/src/*.patch; do \ - patch -d /usr/src/python -p 1 < "${i}"; done \ - && cd /usr/src/python \ - && gnuArch="$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)" \ - && ./configure \ - --build="$gnuArch" \ - --enable-loadable-sqlite-extensions \ - --enable-optimizations \ - --enable-option-checking=fatal \ - --enable-shared \ - --with-lto \ - --with-system-libmpdec \ - --with-system-expat \ - --with-system-ffi \ - --without-ensurepip \ - --without-static-libpython \ - && make -j "$(nproc)" \ - LDFLAGS="-Wl,--strip-all" \ - CFLAGS="-fno-semantic-interposition -fno-builtin-malloc -fno-builtin-calloc -fno-builtin-realloc -fno-builtin-free" \ -# set thread stack size to 1MB so we don't segfault before we hit sys.getrecursionlimit() -# https://github.com/alpinelinux/aports/commit/2026e1259422d4e0cf92391ca2d3844356c649d0 - EXTRA_CFLAGS="-DTHREAD_STACK_SIZE=0x100000" \ - && make install \ - \ - && find /usr/local -type f -executable -not \( -name '*tkinter*' \) -exec scanelf --needed --nobanner --format '%n#p' '{}' ';' \ - | tr ',' '\n' \ - | sort -u \ - | awk 'system("[ -e /usr/local/lib/" $1 " ]") == 0 { next } { print "so:" $1 }' \ - | xargs -rt apk add --no-cache --virtual .python-rundeps \ - && apk del .build-deps \ - \ - && find /usr/local -depth \ - \( \ - -type d -a \( -name test -o -name tests \) \ - \) -exec rm -rf '{}' + \ - && rm -rf /usr/src/python \ - && rm -f /usr/src/*.patch - -# make some useful symlinks that are expected to exist -RUN cd /usr/local/bin \ - && ln -s idle3 idle \ - && ln -s pydoc3 pydoc \ - && ln -s python3 python \ - && ln -s python3-config python-config - -RUN set -ex; \ - \ - apk add --no-cache --virtual .fetch-deps openssl; \ - \ - curl -L -o get-pip.py 'https://bootstrap.pypa.io/get-pip.py'; \ - \ - apk del .fetch-deps; \ - \ - python get-pip.py \ - --disable-pip-version-check \ - --no-cache-dir \ - pip==${PIP_VERSION} \ - ; \ - pip --version; \ - \ - find /usr/local -depth \ - \( \ - -type d -a \( -name test -o -name tests \) \ - \) -exec rm -rf '{}' +; \ - rm -f get-pip.py diff --git a/python/3.10/arm-alignment.patch b/python/3.10/arm-alignment.patch deleted file mode 100644 index a7a4b39..0000000 --- a/python/3.10/arm-alignment.patch +++ /dev/null @@ -1,17 +0,0 @@ -Author: Dave Jones -Description: Use aligned access for _sha3 module on ARM. ---- a/Modules/_sha3/sha3module.c -+++ b/Modules/_sha3/sha3module.c -@@ -64,6 +64,12 @@ - #define PLATFORM_BYTE_ORDER IS_BIG_ENDIAN - #endif - -+/* Bus error on 32-bit ARM due to un-aligned memory accesses; 64-bit ARM -+ * doesn't complain but un-aligned memory accesses are sub-optimal */ -+#if defined(__arm__) || defined(__aarch64__) -+#define NO_MISALIGNED_ACCESSES -+#endif -+ - /* mangle names */ - #define KeccakF1600_FastLoop_Absorb _PySHA3_KeccakF1600_FastLoop_Absorb - #define Keccak_HashFinal _PySHA3_Keccak_HashFinal diff --git a/python/3.10/asynctio_unix_events.patch b/python/3.10/asynctio_unix_events.patch deleted file mode 100644 index 45bf3fc..0000000 --- a/python/3.10/asynctio_unix_events.patch +++ /dev/null @@ -1,16 +0,0 @@ -diff --git a/Lib/asyncio/unix_events.py b/Lib/asyncio/unix_events.py -index f34a5b4b44..b1d0f1e61e 100644 ---- a/Lib/asyncio/unix_events.py -+++ b/Lib/asyncio/unix_events.py -@@ -369,6 +369,11 @@ class _UnixSelectorEventLoop(selector_events.BaseSelectorEventLoop): - fut.set_result(total_sent) - return - -+ # On 32-bit architectures truncate to 1GiB to avoid OverflowError, -+ # see bpo-38319. -+ if sys.maxsize < 2 ** 32: -+ blocksize = min(blocksize, 2 ** 30) -+ - try: - sent = os.sendfile(fd, fileno, offset, blocksize) - except (BlockingIOError, InterruptedError): \ No newline at end of file diff --git a/python/3.10/build.yaml b/python/3.10/build.yaml deleted file mode 100644 index 9a49caa..0000000 --- a/python/3.10/build.yaml +++ /dev/null @@ -1,17 +0,0 @@ -image: ghcr.io/home-assistant/{arch}-base-python -build_from: - aarch64: "ghcr.io/home-assistant/aarch64-base:" - armv7: "ghcr.io/home-assistant/armv7-base:" - armhf: "ghcr.io/home-assistant/armhf-base:" - amd64: "ghcr.io/home-assistant/amd64-base:" - i386: "ghcr.io/home-assistant/i386-base:" -cosign: - base_identity: https://github.com/home-assistant/docker-base/.* - identity: https://github.com/home-assistant/docker-base/.* -args: - PYTHON_VERSION: 3.10.14 - PIP_VERSION: 24.2 - GPG_KEY: A035C8C19219BA821ECEA86B64E628F8D684696D -labels: - io.hass.base.name: python - org.opencontainers.image.source: https://github.com/home-assistant/docker-base diff --git a/python/3.10/fix-xattrs-glibc.patch b/python/3.10/fix-xattrs-glibc.patch deleted file mode 100644 index 6902425..0000000 --- a/python/3.10/fix-xattrs-glibc.patch +++ /dev/null @@ -1,16 +0,0 @@ -diff --git a/Modules/posixmodule.c b/Modules/posixmodule.c -index 8f8ba25..72b92da 100644 ---- a/Modules/posixmodule.c -+++ b/Modules/posixmodule.c -@@ -103,8 +103,9 @@ corresponding Unix manual entries for more information on calls."); - #undef HAVE_SCHED_SETAFFINITY - #endif - --#if defined(HAVE_SYS_XATTR_H) && defined(__GLIBC__) && !defined(__FreeBSD_kernel__) && !defined(__GNU__) -+#if defined(HAVE_SYS_XATTR_H) && defined(__linux__) && !defined(__FreeBSD_kernel__) && !defined(__GNU__) - #define USE_XATTRS -+#include - #endif - - #ifdef USE_XATTRS - diff --git a/python/3.10/musl-find_library.patch b/python/3.10/musl-find_library.patch deleted file mode 100644 index 7899abb..0000000 --- a/python/3.10/musl-find_library.patch +++ /dev/null @@ -1,45 +0,0 @@ -diff -ru Python-2.7.12.orig/Lib/ctypes/util.py Python-2.7.12/Lib/ctypes/util.py ---- Python-2.7.12.orig/Lib/ctypes/util.py 2016-06-26 00:49:30.000000000 +0300 -+++ Python-2.7.12/Lib/ctypes/util.py 2016-11-03 16:05:46.954665040 +0200 -@@ -204,6 +204,41 @@ - def find_library(name, is64 = False): - return _get_soname(_findLib_crle(name, is64) or _findLib_gcc(name)) - -+ elif True: -+ -+ # Patched for Alpine Linux / musl - search manually system paths -+ def _is_elf(filepath): -+ try: -+ with open(filepath, 'rb') as fh: -+ return fh.read(4) == b'\x7fELF' -+ except: -+ return False -+ -+ def find_library(name): -+ from glob import glob -+ # absolute name? -+ if os.path.isabs(name): -+ return name -+ # special case for libm, libcrypt and libpthread and musl -+ if name in ['m', 'crypt', 'pthread']: -+ name = 'c' -+ elif name in ['libm.so', 'libcrypt.so', 'libpthread.so']: -+ name = 'libc.so' -+ # search in standard locations (musl order) -+ paths = ['/lib', '/usr/local/lib', '/usr/lib'] -+ if 'LD_LIBRARY_PATH' in os.environ: -+ paths = os.environ['LD_LIBRARY_PATH'].split(':') + paths -+ for d in paths: -+ f = os.path.join(d, name) -+ if _is_elf(f): -+ return os.path.basename(f) -+ -+ prefix = os.path.join(d, 'lib'+name) -+ for suffix in ['.so', '.so.*']: -+ for f in glob('{0}{1}'.format(prefix, suffix)): -+ if _is_elf(f): -+ return os.path.basename(f) -+ - else: - - def _findSoname_ldconfig(name): From 7477caa061c84a199b7f41befeeb9959a1f02e69 Mon Sep 17 00:00:00 2001 From: Franck Nijhof Date: Tue, 8 Oct 2024 13:47:55 +0200 Subject: [PATCH 3/4] Adjust CI & devcontainer --- .devcontainer/devcontainer.json | 2 +- .github/workflows/builder.yml | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 42ab111..1286699 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -5,7 +5,7 @@ "build": { "dockerfile": "Dockerfile", // Update 'VARIANT' to pick an Alpine version: 3.10, 3.11, 3.12 - "args": { "VARIANT": "3.12" } + "args": { "VARIANT": "3.13" } }, // Set *default* container specific settings.json values on container create. diff --git a/.github/workflows/builder.yml b/.github/workflows/builder.yml index d11f9d3..d026b5a 100644 --- a/.github/workflows/builder.yml +++ b/.github/workflows/builder.yml @@ -12,7 +12,7 @@ env: DEBIAN_LATEST: "bookworm" UBUNTU_LATEST: "20.4" RASPBIAN_LATEST: "bullseye" - PYTHON_LATEST: "3.12" + PYTHON_LATEST: "3.13" jobs: init: @@ -250,7 +250,7 @@ jobs: matrix: arch: ${{ fromJson(needs.init.outputs.architectures_alpine) }} version: ["3.18", "3.19", "3.20"] - python: ["3.10", "3.11", "3.12"] + python: ["3.11", "3.12", "3.13"] steps: - name: Checkout the repository uses: actions/checkout@v4.2.0 From 011f59334ab1ee23a15df2a017a74517ecbd6671 Mon Sep 17 00:00:00 2001 From: Marc Mueller <30130371+cdce8p@users.noreply.github.com> Date: Mon, 4 Nov 2024 18:57:01 +0100 Subject: [PATCH 4/4] Skip failing Python 3.13 tests on musl (#279) --- python/3.13/musl-skip_failing_tests.patch | 70 +++++++++++++++++++++++ 1 file changed, 70 insertions(+) create mode 100644 python/3.13/musl-skip_failing_tests.patch diff --git a/python/3.13/musl-skip_failing_tests.patch b/python/3.13/musl-skip_failing_tests.patch new file mode 100644 index 0000000..3b8b1e3 --- /dev/null +++ b/python/3.13/musl-skip_failing_tests.patch @@ -0,0 +1,70 @@ +commit 5e047972f7c80e95c2baecc9da86ee049df0b9c1 +Author: Marc Mueller <30130371+cdce8p@users.noreply.github.com> +Date: 2024-10-11 20:11:47 +0200 + + Skip failing tests on musl + +diff --git a/Lib/test/support/__init__.py b/Lib/test/support/__init__.py +index ed23f73e3cf..ccc36f7e774 100644 +--- a/Lib/test/support/__init__.py ++++ b/Lib/test/support/__init__.py +@@ -561,6 +561,7 @@ def skip_if_suppress_immortalization(): + # have subprocess or fork support. + is_emscripten = sys.platform == "emscripten" + is_wasi = sys.platform == "wasi" ++is_musl = sys.platform = "linux" + + is_apple_mobile = sys.platform in {"ios", "tvos", "watchos"} + is_apple = is_apple_mobile or sys.platform == "darwin" +diff --git a/Lib/test/test_math.py b/Lib/test/test_math.py +index 541ccdb3d09..4d5f8e982c8 100644 +--- a/Lib/test/test_math.py ++++ b/Lib/test/test_math.py +@@ -1,7 +1,7 @@ + # Python test set -- math module + # XXXX Should not do tests around zero only + +-from test.support import verbose, requires_IEEE_754 ++from test.support import is_musl, verbose, requires_IEEE_754 + from test import support + import unittest + import fractions +@@ -2706,7 +2706,7 @@ def test_fma_infinities(self): + # gh-73468: On some platforms, libc fma() doesn't implement IEE 754-2008 + # properly: it doesn't use the right sign when the result is zero. + @unittest.skipIf( +- sys.platform.startswith(("freebsd", "wasi")) ++ sys.platform.startswith(("freebsd", "wasi")) or is_musl + or (sys.platform == "android" and platform.machine() == "x86_64"), + f"this platform doesn't implement IEE 754-2008 properly") + def test_fma_zero_result(self): +diff --git a/Lib/test/test_re.py b/Lib/test/test_re.py +index 2a46e058e95..a630f79a702 100644 +--- a/Lib/test/test_re.py ++++ b/Lib/test/test_re.py +@@ -1,6 +1,6 @@ + from test.support import (gc_collect, bigmemtest, _2G, + cpython_only, captured_stdout, +- check_disallow_instantiation, is_emscripten, is_wasi, ++ check_disallow_instantiation, is_emscripten, is_musl, is_wasi, + warnings_helper, SHORT_TIMEOUT, CPUStopwatch, requires_resource) + import locale + import re +@@ -2016,7 +2016,7 @@ def test_bug_20998(self): + self.assertEqual(re.fullmatch('[a-c]+', 'ABC', re.I).span(), (0, 3)) + + @unittest.skipIf( +- is_emscripten or is_wasi, ++ is_emscripten or is_wasi or is_musl, + "musl libc issue on Emscripten/WASI, bpo-46390" + ) + def test_locale_caching(self): +@@ -2056,7 +2056,7 @@ def check_en_US_utf8(self): + self.assertIsNone(re.match(b'(?Li)\xe5', b'\xc5')) + + @unittest.skipIf( +- is_emscripten or is_wasi, ++ is_emscripten or is_wasi or is_musl, + "musl libc issue on Emscripten/WASI, bpo-46390" + ) + def test_locale_compiled(self):