diff --git a/ci-matrix.py b/ci-matrix.py index 91cfa953b..38d154fcd 100644 --- a/ci-matrix.py +++ b/ci-matrix.py @@ -9,7 +9,7 @@ import argparse import json import sys -from typing import Any, Optional +from typing import Any import yaml from packaging.version import Version @@ -39,7 +39,7 @@ def meets_conditional_version(version: str, min_version: str) -> bool: return Version(version) >= Version(min_version) -def parse_labels(labels: Optional[str]) -> dict[str, set[str]]: +def parse_labels(labels: str | None) -> dict[str, set[str]]: """Parse labels into a dict of category filters.""" if not labels: return {} @@ -106,7 +106,7 @@ def should_include_entry(entry: dict[str, str], filters: dict[str, set[str]]) -> def generate_docker_matrix_entries( runners: dict[str, Any], - platform_filter: Optional[str] = None, + platform_filter: str | None = None, ) -> list[dict[str, str]]: """Generate matrix entries for docker image builds.""" if platform_filter and platform_filter != "linux": @@ -132,7 +132,7 @@ def generate_crate_build_matrix_entries( runners: dict[str, Any], config: dict[str, Any], force_crate_build: bool = False, - platform_filter: Optional[str] = None, + platform_filter: str | None = None, ) -> list[dict[str, str]]: """Generate matrix entries for crate builds based on python build matrix.""" needed_builds = set() @@ -181,8 +181,8 @@ def generate_crate_build_matrix_entries( def generate_python_build_matrix_entries( config: dict[str, Any], runners: dict[str, Any], - platform_filter: Optional[str] = None, - label_filters: Optional[dict[str, set[str]]] = None, + platform_filter: str | None = None, + label_filters: dict[str, set[str]] | None = None, ) -> list[dict[str, str]]: """Generate matrix entries for python builds.""" matrix_entries = [] @@ -348,10 +348,10 @@ def main() -> None: args = parse_args() labels = parse_labels(args.labels) - with open(CI_TARGETS_YAML, "r") as f: + with open(CI_TARGETS_YAML) as f: config = yaml.safe_load(f) - with open(CI_RUNNERS_YAML, "r") as f: + with open(CI_RUNNERS_YAML) as f: runners = yaml.safe_load(f) # If only free runners are allowed, reduce to a subset diff --git a/ci-targets.yaml b/ci-targets.yaml index 10a13206a..fa3eb0357 100644 --- a/ci-targets.yaml +++ b/ci-targets.yaml @@ -4,7 +4,6 @@ darwin: aarch64-apple-darwin: arch: aarch64 python_versions: - - "3.9" - "3.10" - "3.11" - "3.12" @@ -23,7 +22,6 @@ darwin: x86_64-apple-darwin: arch: x86_64 python_versions: - - "3.9" - "3.10" - "3.11" - "3.12" @@ -44,7 +42,6 @@ linux: arch: aarch64 libc: gnu python_versions: - - "3.9" - "3.10" - "3.11" - "3.12" @@ -64,7 +61,6 @@ linux: arch: armv7 libc: gnu python_versions: - - "3.9" - "3.10" - "3.11" - "3.12" @@ -86,7 +82,6 @@ linux: arch: armv7 libc: gnu python_versions: - - "3.9" - "3.10" - "3.11" - "3.12" @@ -108,7 +103,6 @@ linux: arch: s390x libc: gnu python_versions: - - "3.9" - "3.10" - "3.11" - "3.12" @@ -130,7 +124,6 @@ linux: arch: ppc64le libc: gnu python_versions: - - "3.9" - "3.10" - "3.11" - "3.12" @@ -152,7 +145,6 @@ linux: arch: riscv64 libc: gnu python_versions: - - "3.9" - "3.10" - "3.11" - "3.12" @@ -174,7 +166,6 @@ linux: arch: x86_64 libc: gnu python_versions: - - "3.9" - "3.10" - "3.11" - "3.12" @@ -196,7 +187,6 @@ linux: arch_variant: v2 libc: gnu python_versions: - - "3.9" - "3.10" - "3.11" - "3.12" @@ -218,7 +208,6 @@ linux: arch_variant: v3 libc: gnu python_versions: - - "3.9" - "3.10" - "3.11" - "3.12" @@ -240,7 +229,6 @@ linux: arch_variant: v4 libc: gnu python_versions: - - "3.9" - "3.10" - "3.11" - "3.12" @@ -261,7 +249,6 @@ linux: arch: x86_64 libc: musl python_versions: - - "3.9" - "3.10" - "3.11" - "3.12" @@ -288,7 +275,6 @@ linux: arch_variant: v2 libc: musl python_versions: - - "3.9" - "3.10" - "3.11" - "3.12" @@ -315,7 +301,6 @@ linux: arch_variant: v3 libc: musl python_versions: - - "3.9" - "3.10" - "3.11" - "3.12" @@ -342,7 +327,6 @@ linux: arch_variant: v4 libc: musl python_versions: - - "3.9" - "3.10" - "3.11" - "3.12" @@ -368,7 +352,6 @@ linux: arch: aarch64 libc: musl python_versions: - - "3.9" - "3.10" - "3.11" - "3.12" @@ -396,7 +379,6 @@ windows: arch: x86 vcvars: vcvars32.bat python_versions: - - "3.9" - "3.10" - "3.11" - "3.12" @@ -414,7 +396,6 @@ windows: arch: x86_64 vcvars: vcvars64.bat python_versions: - - "3.9" - "3.10" - "3.11" - "3.12" @@ -432,8 +413,7 @@ windows: arch: aarch64 vcvars: vcvarsamd64_arm64.bat python_versions: - # On 3.9 / 3.10, `_tkinter` is failing to be included in the build - # - "3.9" + # On 3.10, `_tkinter` is failing to be included in the build # - "3.10" - "3.11" - "3.12" diff --git a/cpython-unix/Makefile b/cpython-unix/Makefile index b4618d22f..b6e772c72 100644 --- a/cpython-unix/Makefile +++ b/cpython-unix/Makefile @@ -6,7 +6,7 @@ BUILD := $(HERE)/build.py NULL := SPACE := $(subst ,, ) -ALL_PYTHON_VERSIONS := 3.9 3.10 3.11 3.12 3.13 3.14 3.15 +ALL_PYTHON_VERSIONS := 3.10 3.11 3.12 3.13 3.14 3.15 ifndef PYBUILD_TARGET_TRIPLE $(error PYBUILD_TARGET_TRIPLE not defined) diff --git a/cpython-unix/build-cpython.sh b/cpython-unix/build-cpython.sh index e58f5eff7..9c65394e5 100755 --- a/cpython-unix/build-cpython.sh +++ b/cpython-unix/build-cpython.sh @@ -72,7 +72,7 @@ fi # configure doesn't support cross-compiling on LoongArch. Teach it. if [ "${PYBUILD_PLATFORM}" != "macos" ]; then case "${PYTHON_MAJMIN_VERSION}" in - 3.9|3.10|3.11) + 3.10|3.11) patch -p1 -i ${ROOT}/patch-configure-add-loongarch-triplet.patch ;; esac @@ -85,13 +85,6 @@ if [ -n "${CROSS_COMPILING}" ]; then fi fi -# This patch is slightly different on Python 3.10+. -if [ -n "${PYTHON_MEETS_MINIMUM_VERSION_3_10}" ]; then - patch -p1 -i ${ROOT}/patch-xopen-source-ios.patch -else - patch -p1 -i ${ROOT}/patch-xopen-source-ios-legacy.patch -fi - # LIBTOOL_CRUFT is unused and breaks cross-compiling on macOS. Nuke it. # Submitted upstream at https://github.com/python/cpython/pull/101048. if [ -n "${PYTHON_MEETS_MAXIMUM_VERSION_3_11}" ]; then @@ -175,9 +168,7 @@ fi # executable. This behavior is kinda suspect on all platforms, as it could be adding # library dependencies that shouldn't need to be there. if [[ "${PYBUILD_PLATFORM}" = macos* ]]; then - if [ "${PYTHON_MAJMIN_VERSION}" = "3.9" ]; then - patch -p1 -i ${ROOT}/patch-python-link-modules-3.9.patch - elif [ "${PYTHON_MAJMIN_VERSION}" = "3.10" ]; then + if [ "${PYTHON_MAJMIN_VERSION}" = "3.10" ]; then patch -p1 -i ${ROOT}/patch-python-link-modules-3.10.patch else patch -p1 -i ${ROOT}/patch-python-link-modules-3.11.patch @@ -205,8 +196,6 @@ elif [ "${PYTHON_MAJMIN_VERSION}" = "3.11" ]; then patch -p1 -i ${ROOT}/patch-tkinter-3.11.patch elif [ "${PYTHON_MAJMIN_VERSION}" = "3.10" ]; then patch -p1 -i ${ROOT}/patch-tkinter-3.10.patch -else - patch -p1 -i ${ROOT}/patch-tkinter-3.9.patch fi # Code that runs at ctypes module import time does not work with @@ -214,34 +203,12 @@ fi # See https://bugs.python.org/issue37060. patch -p1 -i ${ROOT}/patch-ctypes-static-binary.patch -# Older versions of Python need patching to work with modern mpdecimal. -if [ -n "${PYTHON_MEETS_MAXIMUM_VERSION_3_9}" ]; then - patch -p1 -i ${ROOT}/patch-decimal-modern-mpdecimal.patch -fi - # We build against libedit instead of readline in all environments. # # On macOS, we use the system/SDK libedit, which is likely somewhat old. # # On Linux, we use our own libedit, which should be modern. # -# CPython 3.10 added proper support for building against libedit outside of -# macOS. On older versions, we need to hack up readline.c to build against -# libedit. This patch breaks older libedit (as seen on macOS) so don't apply -# on macOS. -if [[ -n "${PYTHON_MEETS_MAXIMUM_VERSION_3_9}" && "${PYBUILD_PLATFORM}" != macos* ]]; then - # readline.c assumes that a modern readline API version has a free_history_entry(). - # but libedit does not. Change the #ifdef accordingly. - # - # Similarly, we invoke configure using readline, which sets - # HAVE_RL_COMPLETION_SUPPRESS_APPEND improperly. So hack that. This is a bug - # in our build system, as we should probably be invoking configure again when - # using libedit. - # - # Similar workaround for on_completion_display_matches_hook. - patch -p1 -i ${ROOT}/patch-readline-libedit.patch -fi - if [ "${PYTHON_MAJMIN_VERSION}" = "3.10" ]; then # Even though 3.10 is libedit aware, it isn't compatible with newer # versions of libedit. We need to backport a 3.11 patch to teach the @@ -367,11 +334,8 @@ fi # Always build against libedit instead of the default of readline. # macOS always uses the system libedit, so no tweaks are needed. if [[ "${PYBUILD_PLATFORM}" != macos* ]]; then - # CPython 3.10 introduced proper configure support for libedit, so add configure - # flag there. - if [ -n "${PYTHON_MEETS_MINIMUM_VERSION_3_10}" ]; then - EXTRA_CONFIGURE_FLAGS="${EXTRA_CONFIGURE_FLAGS} --with-readline=editline" - fi + # Add configure flag for proper configure support for libedit. + EXTRA_CONFIGURE_FLAGS="${EXTRA_CONFIGURE_FLAGS} --with-readline=editline" fi # On Python 3.14+, enable the tail calling interpreter which is more performant. @@ -546,25 +510,6 @@ if [[ "${PYBUILD_PLATFORM}" = macos* ]]; then # as Homebrew or MacPorts. So nerf the check to prevent this. CONFIGURE_FLAGS="${CONFIGURE_FLAGS} ac_cv_lib_intl_textdomain=no" - # CPython 3.9+ have proper support for weakly referenced symbols and - # runtime availability guards. CPython 3.8 will emit weak symbol references - # (this happens automatically when linking due to SDK version targeting). - # However CPython lacks the runtime availability guards for most symbols. - # This results in runtime failures when attempting to resolve/call the - # symbol. - if [ -n "${PYTHON_MEETS_MAXIMUM_VERSION_3_9}" ]; then - if [ "${TARGET_TRIPLE}" != "aarch64-apple-darwin" ]; then - for symbol in clock_getres clock_gettime clock_settime faccessat fchmodat fchownat fdopendir fstatat futimens getentropy linkat mkdirat openat preadv pwritev readlinkat renameat symlinkat unlinkat utimensat uttype; do - CONFIGURE_FLAGS="${CONFIGURE_FLAGS} ac_cv_func_${symbol}=no" - done - fi - - # mkfifoat, mknodat introduced in SDK 13.0. - for symbol in mkfifoat mknodat; do - CONFIGURE_FLAGS="${CONFIGURE_FLAGS} ac_cv_func_${symbol}=no" - done - fi - if [ -n "${CROSS_COMPILING}" ]; then # Python's configure doesn't support cross-compiling on macOS. So we need # to explicitly set MACHDEP to avoid busted checks. The code for setting @@ -574,26 +519,10 @@ if [[ "${PYBUILD_PLATFORM}" = macos* ]]; then CONFIGURE_FLAGS="${CONFIGURE_FLAGS} MACHDEP=darwin" CONFIGURE_FLAGS="${CONFIGURE_FLAGS} ac_sys_system=Darwin" CONFIGURE_FLAGS="${CONFIGURE_FLAGS} ac_sys_release=$(uname -r)" - elif [ "${TARGET_TRIPLE}" = "aarch64-apple-ios" ]; then - CONFIGURE_FLAGS="${CONFIGURE_FLAGS} MACHDEP=iOS" - CONFIGURE_FLAGS="${CONFIGURE_FLAGS} ac_sys_system=iOS" - CONFIGURE_FLAGS="${CONFIGURE_FLAGS} ac_sys_release=" - # clock_settime() not available on iOS. - CONFIGURE_FLAGS="${CONFIGURE_FLAGS} ac_cv_func_clock_settime=no" - # getentropy() not available on iOS. - CONFIGURE_FLAGS="${CONFIGURE_FLAGS} ac_cv_func_getentropy=no" elif [ "${TARGET_TRIPLE}" = "x86_64-apple-darwin" ]; then CONFIGURE_FLAGS="${CONFIGURE_FLAGS} MACHDEP=darwin" CONFIGURE_FLAGS="${CONFIGURE_FLAGS} ac_sys_system=Darwin" CONFIGURE_FLAGS="${CONFIGURE_FLAGS} ac_sys_release=$(uname -r)" - elif [ "${TARGET_TRIPLE}" = "x86_64-apple-ios" ]; then - CONFIGURE_FLAGS="${CONFIGURE_FLAGS} MACHDEP=iOS" - CONFIGURE_FLAGS="${CONFIGURE_FLAGS} ac_sys_system=iOS" - CONFIGURE_FLAGS="${CONFIGURE_FLAGS} ac_sys_release=" - # clock_settime() not available on iOS. - CONFIGURE_FLAGS="${CONFIGURE_FLAGS} ac_cv_func_clock_settime=no" - # getentropy() not available on iOS. - CONFIGURE_FLAGS="${CONFIGURE_FLAGS} ac_cv_func_getentropy=no" else echo "unsupported target triple: ${TARGET_TRIPLE}" exit 1 diff --git a/cpython-unix/build-main.py b/cpython-unix/build-main.py index 366ec8cfa..866f0b9be 100755 --- a/cpython-unix/build-main.py +++ b/cpython-unix/build-main.py @@ -55,7 +55,6 @@ def main(): parser.add_argument( "--python", choices={ - "cpython-3.9", "cpython-3.10", "cpython-3.11", "cpython-3.12", diff --git a/cpython-unix/build-sqlite.sh b/cpython-unix/build-sqlite.sh index 1d727c9a2..d39c6bdad 100755 --- a/cpython-unix/build-sqlite.sh +++ b/cpython-unix/build-sqlite.sh @@ -16,12 +16,6 @@ pushd sqlite-autoconf-${SQLITE_VERSION} CONFIGURE_FLAGS="--build=${BUILD_TRIPLE} --host=${TARGET_TRIPLE}" CONFIGURE_FLAGS="${CONFIGURE_FLAGS} --prefix=/tools/deps --disable-shared" -if [ "${TARGET_TRIPLE}" = "aarch64-apple-ios" ]; then - CONFIGURE_FLAGS="${CONFIGURE_FLAGS} ac_cv_search_system=no" -elif [ "${TARGET_TRIPLE}" = "x86_64-apple-ios" ]; then - CONFIGURE_FLAGS="${CONFIGURE_FLAGS} ac_cv_search_system=no" -fi - # The SQLite autosetup looks for the C++ compiler if the variable is set and will fail if it's not # found, even if it's not needed. We don't actually have a C++ compiler in some builds, so ensure # it's not looked for. diff --git a/cpython-unix/build.py b/cpython-unix/build.py index 23d946024..6fd2fe752 100755 --- a/cpython-unix/build.py +++ b/cpython-unix/build.py @@ -444,7 +444,7 @@ def build_cpython_host( # Set environment variables allowing convenient testing for Python # version ranges. - for v in ("3.9", "3.10", "3.11", "3.12", "3.13", "3.14", "3.15"): + for v in ("3.10", "3.11", "3.12", "3.13", "3.14", "3.15"): normal_version = v.replace(".", "_") if meets_python_minimum_version(python_version, v): @@ -483,11 +483,7 @@ def python_build_info( arch = platform.removeprefix("linux_") bi["core"]["static_lib"] = ( - "install/lib/python{version}/config-{version}{binary_suffix}-{arch}-linux-gnu/libpython{version}{binary_suffix}.a".format( - version=version, - binary_suffix=binary_suffix, - arch=arch, - ) + f"install/lib/python{version}/config-{version}{binary_suffix}-{arch}-linux-gnu/libpython{version}{binary_suffix}.a" ) if not static: @@ -508,9 +504,7 @@ def python_build_info( object_file_format = "elf" elif platform.startswith("macos_"): bi["core"]["static_lib"] = ( - "install/lib/python{version}/config-{version}{binary_suffix}-darwin/libpython{version}{binary_suffix}.a".format( - version=version, binary_suffix=binary_suffix - ) + f"install/lib/python{version}/config-{version}{binary_suffix}-darwin/libpython{version}{binary_suffix}.a" ) bi["core"]["shared_lib"] = "install/lib/libpython%s%s.dylib" % ( version, @@ -761,7 +755,7 @@ def build_cpython( static="static" in build_options, ) - packages = target_needs(TARGETS_CONFIG, target_triple, python_version) + packages = target_needs(TARGETS_CONFIG, target_triple) # Toolchain packages are handled specially. packages.discard("binutils") packages.discard("musl") @@ -817,7 +811,7 @@ def build_cpython( # Set environment variables allowing convenient testing for Python # version ranges. - for v in ("3.9", "3.10", "3.11", "3.12", "3.13", "3.14", "3.15"): + for v in ("3.10", "3.11", "3.12", "3.13", "3.14", "3.15"): normal_version = v.replace(".", "_") if meets_python_minimum_version(python_version, v): @@ -1272,7 +1266,6 @@ def main(): ) elif action in ( - "cpython-3.9", "cpython-3.10", "cpython-3.11", "cpython-3.12", diff --git a/cpython-unix/extension-modules.yml b/cpython-unix/extension-modules.yml index 445f52a82..c9e5df9c2 100644 --- a/cpython-unix/extension-modules.yml +++ b/cpython-unix/extension-modules.yml @@ -152,11 +152,6 @@ _ctypes_test: - m _curses: - # ncurses not available on iOS. - disabled-targets: - - .*-apple-ios - - .*-apple-tvos - - .*-apple-watchos sources: - _cursesmodule.c defines: @@ -178,11 +173,6 @@ _curses: - .*-apple-darwin _curses_panel: - # ncurses not available on iOS. - disabled-targets: - - .*-apple-ios - - .*-apple-tvos - - .*-apple-watchos sources: - _curses_panel.c defines: @@ -407,11 +397,6 @@ _opcode: _operator: setup-enabled: true -_peg_parser: - minimum-python-version: "3.9" - maximum-python-version: "3.9" - setup-enabled: true - _pickle: sources: - _pickle.c @@ -448,7 +433,6 @@ _scproxy: # _scproxy is Apple OS only. # APIs required by _scproxy not available on iOS. disabled-targets: - - .*-apple-ios - .*-unknown-linux-.* sources: - _scproxy.c @@ -537,7 +521,7 @@ _sqlite3: includes: - Modules/_sqlite defines-conditional: - # Require dynamic binaries to load extensions. Cannot load on iOS. + # Require dynamic binaries to load extensions. # 3.11+ uses opt in. <3.11 uses opt out. - define: PY_SQLITE_ENABLE_LOAD_EXTENSION=1 targets: @@ -546,11 +530,6 @@ _sqlite3: # linked. But this would break verification code. So enabled for # backwards compatibility. - .*-unknown-linux-.* - - define: SQLITE_OMIT_LOAD_EXTENSION=1 - targets: - - .*-ios - - define: "MODULE_NAME=\\\"sqlite3\\\"" - maximum-python-version: "3.9" links: - sqlite3 @@ -608,7 +587,7 @@ _sysconfig: - _sysconfig.c _testbuffer: - minimum-python-version: '3.9' + minimum-python-version: '3.10' sources: - _testbuffer.c @@ -628,7 +607,7 @@ _testexternalinspection: - _testexternalinspection.c _testimportmultiple: - minimum-python-version: '3.9' + minimum-python-version: '3.10' sources: - _testimportmultiple.c @@ -656,7 +635,7 @@ _testinternalcapi: minimum-python-version: "3.14" _testmultiphase: - minimum-python-version: '3.9' + minimum-python-version: '3.10' sources: - _testmultiphase.c @@ -671,9 +650,6 @@ _thread: - .* _tkinter: - # tk not available on iOS. - disabled-targets: - - .*-apple-ios sources: - _tkinter.c - tkappinit.c @@ -749,13 +725,13 @@ _xxinterpchannels: - _xxinterpchannelsmodule.c _xxsubinterpreters: - minimum-python-version: '3.9' + minimum-python-version: '3.10' maximum-python-version: '3.12' sources: - _xxsubinterpretersmodule.c _xxtestfuzz: - minimum-python-version: '3.9' + minimum-python-version: '3.10' sources: - _xxtestfuzz/_xxtestfuzz.c - _xxtestfuzz/fuzzer.c @@ -771,7 +747,7 @@ _zstd: - zstd _zoneinfo: - minimum-python-version: "3.9" + minimum-python-version: "3.10" sources: - _zoneinfo.c @@ -877,11 +853,6 @@ ossaudiodev: sources: - ossaudiodev.c -parser: - maximum-python-version: "3.9" - sources: - - parsermodule.c - posix: setup-enabled: true required-targets: @@ -898,10 +869,6 @@ pyexpat: - expat readline: - disabled-targets: - - .*-apple-ios - - .*-apple-tvos - - .*-apple-watchos sources: - readline.c defines: diff --git a/cpython-unix/patch-decimal-modern-mpdecimal.patch b/cpython-unix/patch-decimal-modern-mpdecimal.patch deleted file mode 100644 index 87eaa6293..000000000 --- a/cpython-unix/patch-decimal-modern-mpdecimal.patch +++ /dev/null @@ -1,22 +0,0 @@ -diff --git a/Modules/_decimal/_decimal.c b/Modules/_decimal/_decimal.c -index 83e237d02b..9a4329f494 100644 ---- a/Modules/_decimal/_decimal.c -+++ b/Modules/_decimal/_decimal.c -@@ -3293,7 +3293,7 @@ dec_format(PyObject *dec, PyObject *args) - } - else { - size_t n = strlen(spec.dot); -- if (n > 1 || (n == 1 && !isascii((uchar)spec.dot[0]))) { -+ if (n > 1 || (n == 1 && !isascii((unsigned char)spec.dot[0]))) { - /* fix locale dependent non-ascii characters */ - dot = dotsep_as_utf8(spec.dot); - if (dot == NULL) { -@@ -3302,7 +3302,7 @@ dec_format(PyObject *dec, PyObject *args) - spec.dot = PyBytes_AS_STRING(dot); - } - n = strlen(spec.sep); -- if (n > 1 || (n == 1 && !isascii((uchar)spec.sep[0]))) { -+ if (n > 1 || (n == 1 && !isascii((unsigned char)spec.sep[0]))) { - /* fix locale dependent non-ascii characters */ - sep = dotsep_as_utf8(spec.sep); - if (sep == NULL) { diff --git a/cpython-unix/patch-python-configure-add-enable-static-libpython-for-interpreter-3.9.patch b/cpython-unix/patch-python-configure-add-enable-static-libpython-for-interpreter-3.9.patch deleted file mode 100644 index d2c0a45c8..000000000 --- a/cpython-unix/patch-python-configure-add-enable-static-libpython-for-interpreter-3.9.patch +++ /dev/null @@ -1,93 +0,0 @@ -From 5ae9112a87d45c3aff5ee269ff8e2e49ca278ed3 Mon Sep 17 00:00:00 2001 -From: Geoffrey Thomas -Date: Sat, 19 Apr 2025 11:13:40 -0400 -Subject: [PATCH 1/1] configure: add --enable-static-libpython-for-interpreter - -This option changes the behavior of --enable-shared to continue to build -the libpython3.x.so shared library, but not use it for linking the -python3 interpreter executable. Instead, the executable is linked -directly against the libpython .o files as it would be with ---disable-shared [in newer versions of Python]. - -There are two benefits of this change. First, libpython uses -thread-local storage, which is noticeably slower when used in a loaded -module instead of in the main program, because the main program can take -advantage of constant offsets from the thread state pointer but loaded -modules have to dynamically call a function __tls_get_addr() to -potentially allocate their thread-local storage area. (There is another -thread-local storage model for dynamic libraries which mitigates most of -this performance hit, but it comes at the cost of preventing -dlopen("libpython3.x.so"), which is a use case we want to preserve.) - -Second, this improves the user experience around relocatable Python a -little bit, in that we don't need to use an $ORIGIN-relative path to -locate libpython3.x.so, which has some mild benefits around musl (which -does not support $ORIGIN-relative DT_NEEDED, only $ORIGIN-relative -DT_RPATH/DT_RUNPATH), users who want to make the interpreter setuid or -setcap (which prevents processing $ORIGIN), etc. ---- - Makefile.pre.in | 4 +++- - configure.ac | 18 ++++++++++++++++++ - 2 files changed, 21 insertions(+), 1 deletion(-) - -diff --git a/Makefile.pre.in b/Makefile.pre.in -index a276d535c7f..193439aa73e 100644 ---- a/Makefile.pre.in -+++ b/Makefile.pre.in -@@ -460,6 +460,8 @@ LIBRARY_OBJS= \ - $(LIBRARY_OBJS_OMIT_FROZEN) \ - Python/frozen.o - -+LINK_PYTHON_OBJS=@LINK_PYTHON_OBJS@ -+ - ########################################################################## - # DTrace - -@@ -589,7 +591,7 @@ clinic: check-clean-src $(srcdir)/Modules/_blake2/blake2s_impl.c - - # Build the interpreter - $(BUILDPYTHON): Programs/python.o $(LIBRARY) $(LDLIBRARY) $(PY3LIBRARY) $(EXPORTSYMS) -- $(LINKCC) $(PY_CORE_LDFLAGS) $(LINKFORSHARED) -o $@ Programs/python.o $(BLDLIBRARY) $(LIBS) $(MODLIBS) $(SYSLIBS) -+ $(LINKCC) $(PY_CORE_LDFLAGS) $(LINKFORSHARED) -o $@ Programs/python.o $(LINK_PYTHON_OBJS) $(LIBS) $(MODLIBS) $(SYSLIBS) - - platform: $(BUILDPYTHON) pybuilddir.txt - $(RUNSHARED) $(PYTHON_FOR_BUILD) -c 'import sys ; from sysconfig import get_platform ; print("%s-%d.%d" % (get_platform(), *sys.version_info[:2]))' >platform -diff --git a/configure.ac b/configure.ac -index aa515da4655..122b11def62 100644 ---- a/configure.ac -+++ b/configure.ac -@@ -1106,6 +1106,17 @@ then - fi - AC_MSG_RESULT($enable_shared) - -+AC_MSG_CHECKING([for --enable-static-libpython-for-interpreter]) -+AC_ARG_ENABLE([static-libpython-for-interpreter], -+ AS_HELP_STRING([--enable-static-libpython-for-interpreter], -+ [even with --enable-shared, statically link libpython into the interpreter (default is to use the shared library)])) -+ -+if test -z "$enable_static_libpython_for_interpreter" -+then -+ enable_static_libpython_for_interpreter="no" -+fi -+AC_MSG_RESULT([$enable_static_libpython_for_interpreter]) -+ - AC_MSG_CHECKING(for --enable-profiling) - AC_ARG_ENABLE(profiling, - AS_HELP_STRING([--enable-profiling], [enable C-level code profiling with gprof (default is no)])) -@@ -1211,6 +1222,13 @@ fi - - AC_MSG_RESULT($LDLIBRARY) - -+if test "$enable_static_libpython_for_interpreter" = "yes"; then -+ LINK_PYTHON_OBJS='$(LIBRARY_OBJS)' -+else -+ LINK_PYTHON_OBJS='$(BLDLIBRARY)' -+fi -+AC_SUBST(LINK_PYTHON_OBJS) -+ - AC_SUBST(AR) - AC_CHECK_TOOLS(AR, ar aal, ar) - --- -2.39.5 (Apple Git-154) - diff --git a/cpython-unix/patch-python-link-modules-3.9.patch b/cpython-unix/patch-python-link-modules-3.9.patch deleted file mode 100644 index 772cacced..000000000 --- a/cpython-unix/patch-python-link-modules-3.9.patch +++ /dev/null @@ -1,12 +0,0 @@ -diff --git a/Makefile.pre.in b/Makefile.pre.in ---- a/Makefile.pre.in -+++ b/Makefile.pre.in -@@ -563,7 +563,7 @@ clinic: check-clean-src $(srcdir)/Modules/_blake2/blake2s_impl.c - - # Build the interpreter - $(BUILDPYTHON): Programs/python.o $(LIBRARY) $(LDLIBRARY) $(PY3LIBRARY) $(EXPORTSYMS) -- $(LINKCC) $(PY_CORE_LDFLAGS) $(LINKFORSHARED) -o $@ Programs/python.o $(BLDLIBRARY) $(LIBS) $(MODLIBS) $(SYSLIBS) -+ $(LINKCC) $(PY_CORE_LDFLAGS) $(LINKFORSHARED) -o $@ Programs/python.o $(BLDLIBRARY) $(LIBS) $(SYSLIBS) - - platform: $(BUILDPYTHON) pybuilddir.txt - $(RUNSHARED) $(PYTHON_FOR_BUILD) -c 'import sys ; from sysconfig import get_platform ; print("%s-%d.%d" % (get_platform(), *sys.version_info[:2]))' >platform diff --git a/cpython-unix/patch-readline-libedit.patch b/cpython-unix/patch-readline-libedit.patch deleted file mode 100644 index 534f9a456..000000000 --- a/cpython-unix/patch-readline-libedit.patch +++ /dev/null @@ -1,49 +0,0 @@ -diff --git a/Modules/readline.c b/Modules/readline.c -index 1e74f997b07..0c982857283 100644 ---- a/Modules/readline.c -+++ b/Modules/readline.c -@@ -35,7 +35,7 @@ - #define completion_matches(x, y) \ - rl_completion_matches((x), ((rl_compentry_func_t *)(y))) - #else --#if defined(_RL_FUNCTION_TYPEDEF) -+#ifdef USE_LIBEDIT - extern char **completion_matches(char *, rl_compentry_func_t *); - #else - -@@ -390,7 +390,7 @@ set_completion_display_matches_hook(PyObject *self, PyObject *args) - default completion display. */ - rl_completion_display_matches_hook = - readlinestate_global->completion_display_matches_hook ? --#if defined(_RL_FUNCTION_TYPEDEF) -+#ifdef USE_LIBEDIT - (rl_compdisp_func_t *)on_completion_display_matches_hook : 0; - #else - (VFunction *)on_completion_display_matches_hook : 0; -@@ -511,7 +511,7 @@ set the word delimiters for completion"); - - /* _py_free_history_entry: Utility function to free a history entry. */ - --#if defined(RL_READLINE_VERSION) && RL_READLINE_VERSION >= 0x0500 -+#ifndef USE_LIBEDIT - - /* Readline version >= 5.0 introduced a timestamp field into the history entry - structure; this needs to be freed to avoid a memory leak. This version of -@@ -1055,7 +1055,7 @@ flex_complete(const char *text, int start, int end) - #ifdef HAVE_RL_COMPLETION_APPEND_CHARACTER - rl_completion_append_character ='\0'; - #endif --#ifdef HAVE_RL_COMPLETION_SUPPRESS_APPEND -+#ifndef USE_LIBEDIT - rl_completion_suppress_append = 0; - #endif - -@@ -1241,7 +1241,7 @@ readline_until_enter_or_signal(const char *prompt, int *signal) - PyEval_SaveThread(); - if (s < 0) { - rl_free_line_state(); --#if defined(RL_READLINE_VERSION) && RL_READLINE_VERSION >= 0x0700 -+#ifndef USE_LIBEDIT - rl_callback_sigcleanup(); - #endif - rl_cleanup_after_signal(); diff --git a/cpython-unix/patch-tkinter-3.9.patch b/cpython-unix/patch-tkinter-3.9.patch deleted file mode 100644 index 3e99eb38a..000000000 --- a/cpython-unix/patch-tkinter-3.9.patch +++ /dev/null @@ -1,117 +0,0 @@ -diff --git a/Modules/_tkinter.c b/Modules/_tkinter.c -index e153047b778..02f5d12db1a 100644 ---- a/Modules/_tkinter.c -+++ b/Modules/_tkinter.c -@@ -115,6 +115,7 @@ Copyright (C) 1994 Steen Lumholt. - #ifdef MS_WINDOWS - #include - #define WAIT_FOR_STDIN -+#endif - - static PyObject * - _get_tcl_lib_path() -@@ -132,6 +133,7 @@ _get_tcl_lib_path() - return NULL; - } - -+#ifdef MS_WINDOWS - /* Check expected location for an installed Python first */ - tcl_library_path = PyUnicode_FromString("\\tcl\\tcl" TCL_VERSION); - if (tcl_library_path == NULL) { -@@ -169,11 +171,31 @@ _get_tcl_lib_path() - tcl_library_path = NULL; - #endif - } -+#else -+ /* Check expected location for an installed Python first */ -+ tcl_library_path = PyUnicode_FromString("/lib/tcl" TCL_VERSION); -+ if (tcl_library_path == NULL) { -+ return NULL; -+ } -+ tcl_library_path = PyUnicode_Concat(prefix, tcl_library_path); -+ if (tcl_library_path == NULL) { -+ return NULL; -+ } -+ stat_return_value = _Py_stat(tcl_library_path, &stat_buf); -+ if (stat_return_value == -2) { -+ return NULL; -+ } -+ if (stat_return_value == -1) { -+ /* install location doesn't exist, reset errno and leave Tcl -+ to its own devices */ -+ errno = 0; -+ tcl_library_path = NULL; -+ } -+#endif - already_checked = 1; - } - return tcl_library_path; - } --#endif /* MS_WINDOWS */ - - /* The threading situation is complicated. Tcl is not thread-safe, except - when configured with --enable-threads. -@@ -822,6 +844,30 @@ Tkapp_New(const char *screenName, const char *className, - - ret = GetEnvironmentVariableW(L"TCL_LIBRARY", NULL, 0); - if (!ret && GetLastError() == ERROR_ENVVAR_NOT_FOUND) { -+ str_path = _get_tcl_lib_path(); -+ if (str_path == NULL && PyErr_Occurred()) { -+ return NULL; -+ } -+ if (str_path != NULL) { -+ utf8_path = PyUnicode_AsUTF8String(str_path); -+ if (utf8_path == NULL) { -+ return NULL; -+ } -+ Tcl_SetVar(v->interp, -+ "tcl_library", -+ PyBytes_AS_STRING(utf8_path), -+ TCL_GLOBAL_ONLY); -+ Py_DECREF(utf8_path); -+ } -+ } -+ } -+#else -+ { -+ const char *env_val = getenv("TCL_LIBRARY"); -+ if (!env_val) { -+ PyObject *str_path; -+ PyObject *utf8_path; -+ - str_path = _get_tcl_lib_path(); - if (str_path == NULL && PyErr_Occurred()) { - return NULL; -@@ -3631,7 +3677,32 @@ PyInit__tkinter(void) - PyMem_Free(wcs_path); - } - #else -+ int set_var = 0; -+ PyObject *str_path; -+ char *path; -+ -+ if (!getenv("TCL_LIBRARY")) { -+ str_path = _get_tcl_lib_path(); -+ if (str_path == NULL && PyErr_Occurred()) { -+ Py_DECREF(m); -+ return NULL; -+ } -+ if (str_path != NULL) { -+ path = PyUnicode_AsUTF8(str_path); -+ if (path == NULL) { -+ Py_DECREF(m); -+ return NULL; -+ } -+ setenv("TCL_LIBRARY", path, 1); -+ set_var = 1; -+ } -+ } -+ - Tcl_FindExecutable(PyBytes_AS_STRING(cexe)); -+ -+ if (set_var) { -+ unsetenv("TCL_LIBRARY"); -+ } - #endif /* MS_WINDOWS */ - } - Py_XDECREF(cexe); diff --git a/cpython-unix/patch-xopen-source-ios-legacy.patch b/cpython-unix/patch-xopen-source-ios-legacy.patch deleted file mode 100644 index 00484f1f0..000000000 --- a/cpython-unix/patch-xopen-source-ios-legacy.patch +++ /dev/null @@ -1,17 +0,0 @@ -diff --git a/configure.ac b/configure.ac -index aa515da465..2feb013926 100644 ---- a/configure.ac -+++ b/configure.ac -@@ -521,6 +521,12 @@ case $ac_sys_system/$ac_sys_release in - define_xopen_source=no;; - Darwin/@<:@[12]@:>@@<:@0-9@:>@.*) - define_xopen_source=no;; -+ iOS/*) -+ define_xopen_source=no;; -+ tvOS/*) -+ define_xopen_source=no;; -+ watchOS/*) -+ define_xopen_source=no;; - # On AIX 4 and 5.1, mbstate_t is defined only when _XOPEN_SOURCE == 500 but - # used in wcsnrtombs() and mbsnrtowcs() even if _XOPEN_SOURCE is not defined - # or has another value. By not (re)defining it, the defaults come in place. diff --git a/cpython-unix/patch-xopen-source-ios.patch b/cpython-unix/patch-xopen-source-ios.patch deleted file mode 100644 index e59ca5f30..000000000 --- a/cpython-unix/patch-xopen-source-ios.patch +++ /dev/null @@ -1,17 +0,0 @@ -diff --git a/configure.ac b/configure.ac -index cc69015b10..e7fde9c027 100644 ---- a/configure.ac -+++ b/configure.ac -@@ -521,6 +521,12 @@ case $ac_sys_system/$ac_sys_release in - define_xopen_source=no;; - Darwin/@<:@[12]@:>@@<:@0-9@:>@.*) - define_xopen_source=no;; -+ iOS/*) -+ define_xopen_source=no;; -+ tvOS/*) -+ define_xopen_source=no;; -+ watchOS/*) -+ define_xopen_source=no;; - # On QNX 6.3.2, defining _XOPEN_SOURCE prevents netdb.h from - # defining NI_NUMERICHOST. - QNX/6.3.2) diff --git a/cpython-unix/targets.yml b/cpython-unix/targets.yml index f700e705f..64b0d5ecd 100644 --- a/cpython-unix/targets.yml +++ b/cpython-unix/targets.yml @@ -64,7 +64,6 @@ aarch64-apple-darwin: - macos_arm64 - macos_x86_64 pythons_supported: - - '3.9' - '3.10' - '3.11' - '3.12' @@ -112,56 +111,11 @@ aarch64-apple-darwin: - zstd openssl_target: darwin64-arm64-cc -aarch64-apple-ios: - host_platforms: - - macos_arm64 - - macos_x86_64 - pythons_supported: - - '3.9' - needs_toolchain: true - apple_sdk_platform: iphoneos - host_cc: clang - host_cxx: clang++ - target_cc: clang - target_cxx: clang++ - target_cflags: - - '-arch' - - 'arm64' - - '-mios-version-min=12.3' - # Suppress extremely verbose warnings we see with LLVM 10. - - '-Wno-nullability-completeness' - - '-Wno-expansion-to-defined' - # LLVM 11 contains commit https://reviews.llvm.org/D83250, - # which enables -Werror for undef-prefix=TARGET_OS_. - # However, the macOS SDK has headers that reference deprecated - # TARGET_OS defines, like TARGET_OS_EMBEDDED. So LLVM 11 refuses - # to work with the macOS SDKs out of the box. We work around - # this by undoing the -Werror=undef-prefix in that commit. - - '-Wno-undef-prefix' - - '-fvisibility=hidden' - target_ldflags: - - '-arch' - - 'arm64' - - '-mios-version-min=12.3' - needs: - - autoconf - - bzip2 - - expat - - libffi - - m4 - - mpdecimal - - openssl-3.5 - - sqlite - - xz - - zstd - openssl_target: ios64-cross - aarch64-unknown-linux-gnu: host_platforms: - linux_x86_64 - linux_aarch64 pythons_supported: - - '3.9' - '3.10' - '3.11' - '3.12' @@ -209,54 +163,10 @@ aarch64-unknown-linux-gnu: # See https://github.com/llvm/llvm-project/issues/146541 # bolt_capable: true -arm64-apple-tvos: - host_platforms: - - macos_arm64 - - macos_x86_64 - pythons_supported: - - '3.9' - needs_toolchain: true - apple_sdk_platform: appletvos - host_cc: clang - host_cxx: clang++ - target_cc: clang - target_cxx: clang++ - target_cflags: - - '-arch' - - 'arm64' - - '-mappletvos-version-min=12.3' - # Suppress extremely verbose warnings we see with LLVM 10. - - '-Wno-nullability-completeness' - - '-Wno-expansion-to-defined' - # LLVM 11 contains commit https://reviews.llvm.org/D83250, - # which enables -Werror for undef-prefix=TARGET_OS_. - # However, the macOS SDK has headers that reference deprecated - # TARGET_OS defines, like TARGET_OS_EMBEDDED. So LLVM 11 refuses - # to work with the macOS SDKs out of the box. We work around - # this by undoing the -Werror=undef-prefix in that commit. - - '-Wno-undef-prefix' - - '-fvisibility=hidden' - target_ldflags: - - '-arch' - - 'arm64' - - '-mappletvos-version-min=12.3' - needs: - - autoconf - - bzip2 - - expat - - m4 - - mpdecimal - - openssl-3.5 - - sqlite - - xz - - zstd - openssl_target: todo - armv7-unknown-linux-gnueabi: host_platforms: - linux_x86_64 pythons_supported: - - '3.9' - '3.10' - '3.11' - '3.12' @@ -298,7 +208,6 @@ armv7-unknown-linux-gnueabihf: host_platforms: - linux_x86_64 pythons_supported: - - '3.9' - '3.10' - '3.11' - '3.12' @@ -340,7 +249,6 @@ loongarch64-unknown-linux-gnu: host_platforms: - linux_x86_64 pythons_supported: - - '3.9' - '3.10' - '3.11' - '3.12' @@ -381,7 +289,6 @@ mips-unknown-linux-gnu: host_platforms: - linux_x86_64 pythons_supported: - - '3.9' - '3.10' - '3.11' - '3.12' @@ -423,7 +330,6 @@ mipsel-unknown-linux-gnu: host_platforms: - linux_x86_64 pythons_supported: - - '3.9' - '3.10' - '3.11' - '3.12' @@ -465,7 +371,6 @@ ppc64le-unknown-linux-gnu: host_platforms: - linux_x86_64 pythons_supported: - - '3.9' - '3.10' - '3.11' - '3.12' @@ -507,7 +412,6 @@ riscv64-unknown-linux-gnu: host_platforms: - linux_x86_64 pythons_supported: - - '3.9' - '3.10' - '3.11' - '3.12' @@ -549,7 +453,6 @@ s390x-unknown-linux-gnu: host_platforms: - linux_x86_64 pythons_supported: - - '3.9' - '3.10' - '3.11' - '3.12' @@ -590,49 +493,6 @@ s390x-unknown-linux-gnu: - zstd openssl_target: linux64-s390x -thumb7k-apple-watchos: - host_platforms: - - macos_arm64 - - macos_x86_64 - pythons_supported: - - '3.9' - needs_toolchain: true - apple_sdk_platform: watchos - host_cc: clang - host_cxx: clang++ - target_cc: clang - target_cxx: clang++ - target_cflags: - - '-arch' - - 'armv7k' - - '-mwatchos-version-min-7.0' - # Suppress extremely verbose warnings we see with LLVM 10. - - '-Wno-nullability-completeness' - - '-Wno-expansion-to-defined' - # LLVM 11 contains commit https://reviews.llvm.org/D83250, - # which enables -Werror for undef-prefix=TARGET_OS_. - # However, the macOS SDK has headers that reference deprecated - # TARGET_OS defines, like TARGET_OS_EMBEDDED. So LLVM 11 refuses - # to work with the macOS SDKs out of the box. We work around - # this by undoing the -Werror=undef-prefix in that commit. - - '-Wno-undef-prefix' - - '-fvisibility=hidden' - target_ldflags: - - '-arch' - - 'armv7k' - - '-mwatchos-version-min-7.0' - needs: - - autoconf - - bzip2 - - expat - - m4 - - mpdecimal - - openssl-3.5 - - sqlite - - xz - - zstd - openssl_target: todo - # Intel macOS. # # We target compatibility with macOS 10.15+ for compatibility with older Apple @@ -642,7 +502,6 @@ x86_64-apple-darwin: - macos_arm64 - macos_x86_64 pythons_supported: - - '3.9' - '3.10' - '3.11' - '3.12' @@ -690,141 +549,10 @@ x86_64-apple-darwin: - zstd openssl_target: darwin64-x86_64-cc -x86_64-apple-ios: - host_platforms: - - macos_arm64 - - macos_x86_64 - pythons_supported: - - '3.9' - needs_toolchain: true - apple_sdk_platform: iphonesimulator - host_cc: clang - host_cxx: clang++ - target_cc: clang - target_cxx: clang++ - target_cflags: - - '-arch' - - 'x86_64' - - '-mios-simulator-version-min=12.3' - # Suppress extremely verbose warnings we see with LLVM 10. - - '-Wno-nullability-completeness' - - '-Wno-expansion-to-defined' - # LLVM 11 contains commit https://reviews.llvm.org/D83250, - # which enables -Werror for undef-prefix=TARGET_OS_. - # However, the macOS SDK has headers that reference deprecated - # TARGET_OS defines, like TARGET_OS_EMBEDDED. So LLVM 11 refuses - # to work with the macOS SDKs out of the box. We work around - # this by undoing the -Werror=undef-prefix in that commit. - - '-Wno-undef-prefix' - - '-fvisibility=hidden' - target_ldflags: - - '-arch' - - 'x86_64' - - '-mios-simulator-version-min=12.3' - needs: - - autoconf - - bzip2 - - expat - - libffi - - m4 - - mpdecimal - - openssl-3.5 - - sqlite - - xz - - zstd - openssl_target: darwin64-x86_64-cc - -x86_64-apple-tvos: - host_platforms: - - macos_arm64 - - macos_x86_64 - pythons_supported: - - '3.9' - needs_toolchain: true - apple_sdk_platform: appletvsimulator - host_cc: clang - host_cxx: clang++ - target_cc: clang - target_cxx: clang++ - target_cflags: - - '-arch' - - 'x86_64' - - '-mappletvsimulator-version-min=12.3' - # Suppress extremely verbose warnings we see with LLVM 10. - - '-Wno-nullability-completeness' - - '-Wno-expansion-to-defined' - # LLVM 11 contains commit https://reviews.llvm.org/D83250, - # which enables -Werror for undef-prefix=TARGET_OS_. - # However, the macOS SDK has headers that reference deprecated - # TARGET_OS defines, like TARGET_OS_EMBEDDED. So LLVM 11 refuses - # to work with the macOS SDKs out of the box. We work around - # this by undoing the -Werror=undef-prefix in that commit. - - '-Wno-undef-prefix' - - '-fvisibility=hidden' - target_ldflags: - - '-arch' - - 'x86_64' - - '-mappletvsimulator-version-min=12.3' - needs: - - autoconf - - bzip2 - - expat - - m4 - - mpdecimal - - openssl-3.5 - - sqlite - - xz - - zstd - openssl_target: todo - -x86_64-apple-watchos: - host_platforms: - - macos_arm64 - - macos_x86_64 - pythons_supported: - - '3.9' - needs_toolchain: true - apple_sdk_platform: watchsimulator - host_cc: clang - host_cxx: clang++ - target_cc: clang - target_cxx: clang++ - target_cflags: - - '-arch' - - 'x86_64' - - '-mwatchsimulator-version-min=7.0' - # Suppress extremely verbose warnings we see with LLVM 10. - - '-Wno-nullability-completeness' - - '-Wno-expansion-to-defined' - # LLVM 11 contains commit https://reviews.llvm.org/D83250, - # which enables -Werror for undef-prefix=TARGET_OS_. - # However, the macOS SDK has headers that reference deprecated - # TARGET_OS defines, like TARGET_OS_EMBEDDED. So LLVM 11 refuses - # to work with the macOS SDKs out of the box. We work around - # this by undoing the -Werror=undef-prefix in that commit. - - '-Wno-undef-prefix' - - '-fvisibility=hidden' - target_ldflags: - - '-arch' - - 'x86_64' - - '-mwatchsimulator-version-min=7.0' - needs: - - autoconf - - bzip2 - - expat - - m4 - - mpdecimal - - openssl-3.5 - - sqlite - - xz - - zstd - openssl_target: todo - x86_64-unknown-linux-gnu: host_platforms: - linux_x86_64 pythons_supported: - - '3.9' - '3.10' - '3.11' - '3.12' @@ -871,7 +599,6 @@ x86_64_v2-unknown-linux-gnu: host_platforms: - linux_x86_64 pythons_supported: - - '3.9' - '3.10' - '3.11' - '3.12' @@ -919,7 +646,6 @@ x86_64_v3-unknown-linux-gnu: host_platforms: - linux_x86_64 pythons_supported: - - '3.9' - '3.10' - '3.11' - '3.12' @@ -967,7 +693,6 @@ x86_64_v4-unknown-linux-gnu: host_platforms: - linux_x86_64 pythons_supported: - - '3.9' - '3.10' - '3.11' - '3.12' @@ -1015,7 +740,6 @@ x86_64-unknown-linux-musl: host_platforms: - linux_x86_64 pythons_supported: - - '3.9' - '3.10' - '3.11' - '3.12' @@ -1060,7 +784,6 @@ x86_64_v2-unknown-linux-musl: host_platforms: - linux_x86_64 pythons_supported: - - '3.9' - '3.10' - '3.11' - '3.12' @@ -1106,7 +829,6 @@ x86_64_v3-unknown-linux-musl: host_platforms: - linux_x86_64 pythons_supported: - - '3.9' - '3.10' - '3.11' - '3.12' @@ -1152,7 +874,6 @@ x86_64_v4-unknown-linux-musl: host_platforms: - linux_x86_64 pythons_supported: - - '3.9' - '3.10' - '3.11' - '3.12' @@ -1199,7 +920,6 @@ aarch64-unknown-linux-musl: - linux_x86_64 - linux_aarch64 pythons_supported: - - '3.9' - '3.10' - '3.11' - '3.12' diff --git a/cpython-windows/build.py b/cpython-windows/build.py index d02559e07..d113cbbed 100644 --- a/cpython-windows/build.py +++ b/cpython-windows/build.py @@ -1850,7 +1850,6 @@ def main() -> None: parser.add_argument( "--python", choices={ - "cpython-3.9", "cpython-3.10", "cpython-3.11", "cpython-3.12", @@ -1902,7 +1901,7 @@ def main() -> None: # CPython 3.11+ have native support for OpenSSL 3.x. We anticipate this # will change in a future minor release once OpenSSL 1.1 goes out of support. # But who knows. - if args.python in ("cpython-3.9", "cpython-3.10"): + if args.python == "cpython-3.10": openssl_entry = "openssl-1.1" else: openssl_entry = "openssl-3.5" diff --git a/docs/building.rst b/docs/building.rst index 4557072ae..410a6fb65 100644 --- a/docs/building.rst +++ b/docs/building.rst @@ -7,7 +7,7 @@ Building Linux ===== -The host system must be 64-bit. A Python 3.9+ interpreter must be +The host system must be 64-bit. A Python 3.10+ interpreter must be available. The execution environment must have access to a Docker daemon (all build operations are performed in Docker containers for isolation from the host system). diff --git a/docs/quirks.rst b/docs/quirks.rst index 84b2e1edc..1259f23ef 100644 --- a/docs/quirks.rst +++ b/docs/quirks.rst @@ -53,7 +53,7 @@ the *terminfo database* in an uncommon location, you can set the For instance, you may need to do something like: - $ TERMINFO_DIRS=/uncommon/place/terminfo install/bin/python3.9 + $ TERMINFO_DIRS=/uncommon/place/terminfo install/bin/python3.10 If you are running on a relatively standard OS and this does not work out of the box, please file a bug report so we can add the location of @@ -106,7 +106,7 @@ about the ``python`` executable that pip uses.) Linking Static Library on macOS =============================== -Python 3.9+ makes use of the ``__builtin_available()`` compiler feature. +Python 3.10+ makes use of the ``__builtin_available()`` compiler feature. This functionality requires a symbol from ``libclang_rt``, which may not be linked by default. Failure to link against ``libclang_rt`` could result in a linker error due to an undefined symbol ``___isOSVersionAtLeast``. diff --git a/docs/status.rst b/docs/status.rst index cd50e078d..41f4de1db 100644 --- a/docs/status.rst +++ b/docs/status.rst @@ -5,7 +5,7 @@ Project Status ============== There is support for producing CPython distributions for Windows, -macOS, Linux, and iOS. All distributions are highly self-contained and have +macOS, and Linux. All distributions are highly self-contained and have limited shared library dependencies. Planned and features include: @@ -19,15 +19,6 @@ Planned and features include: Target Notes ============ -Non-Darwin Apple Targets ------------------------- - -Apple targets that aren't Darwin/macOS (iOS, tvOS, watchOS, and corresponding -simulators) are considered alpha quality. The builds may or may not work. The -builds haven't been widely tested. - -Only Python 3.9 is currently supported. - Non-x86 Linux Targets --------------------- diff --git a/pythonbuild/buildenv.py b/pythonbuild/buildenv.py index 9266ad37e..a946813ed 100644 --- a/pythonbuild/buildenv.py +++ b/pythonbuild/buildenv.py @@ -23,7 +23,7 @@ ) -class ContainerContext(object): +class ContainerContext: def __init__(self, container): self.container = container @@ -139,7 +139,7 @@ def find_output_files(self, base_path, pattern): yield line[len("/build/out/%s/" % base_path) :].decode("ascii") -class TempdirContext(object): +class TempdirContext: def __init__(self, td): self.td = pathlib.Path(td) diff --git a/pythonbuild/downloads.py b/pythonbuild/downloads.py index e0811bba7..b4b28b434 100644 --- a/pythonbuild/downloads.py +++ b/pythonbuild/downloads.py @@ -47,15 +47,6 @@ "licenses": ["bzip2-1.0.6"], "license_file": "LICENSE.bzip2.txt", }, - "cpython-3.9": { - "url": "https://www.python.org/ftp/python/3.9.25/Python-3.9.25.tar.xz", - "size": 20183236, - "sha256": "00e07d7c0f2f0cc002432d1ee84d2a40dae404a99303e3f97701c10966c91834", - "version": "3.9.25", - "licenses": ["Python-2.0", "CNRI-Python"], - "license_file": "LICENSE.cpython.txt", - "python_tag": "cp39", - }, "cpython-3.10": { "url": "https://www.python.org/ftp/python/3.10.19/Python-3.10.19.tar.xz", "size": 19873020, diff --git a/pythonbuild/utils.py b/pythonbuild/utils.py index 90acbeb64..36c3f9fb2 100644 --- a/pythonbuild/utils.py +++ b/pythonbuild/utils.py @@ -96,16 +96,14 @@ def supported_targets(yaml_path: pathlib.Path): return targets -def target_needs(yaml_path: pathlib.Path, target: str, python_version: str): +def target_needs(yaml_path: pathlib.Path, target: str): """Obtain the dependencies needed to build the specified target.""" settings = get_targets(yaml_path)[target] needs = set(settings["needs"]) - # We only ship libedit linked readline extension on 3.10+ to avoid a GPL - # dependency. - if not python_version.startswith("3.9"): - needs.discard("readline") + # Ship libedit linked readline extension to avoid a GPL dependency. + needs.discard("readline") return needs @@ -571,7 +569,7 @@ def add_env_common(env): env_path = os.path.expanduser("~/.python-build-standalone-env") try: - with open(env_path, "r") as fh: + with open(env_path) as fh: for line in fh: line = line.strip() if line.startswith("#"): diff --git a/src/github.rs b/src/github.rs index 87e316e0a..f7df4b574 100644 --- a/src/github.rs +++ b/src/github.rs @@ -180,7 +180,7 @@ pub async fn command_fetch_release_distributions(args: &ArgMatches) -> Result<() let (client, _) = new_github_client(args)?; - let release_version_range = pep440_rs::VersionSpecifier::from_str(">=3.9")?; + let release_version_range = pep440_rs::VersionSpecifier::from_str(">=3.10")?; let workflows = client.workflows(org, repo); diff --git a/src/release.rs b/src/release.rs index 9558361ce..0fb00e819 100644 --- a/src/release.rs +++ b/src/release.rs @@ -183,7 +183,7 @@ pub static RELEASE_TRIPLES: Lazy> = Lazy:: TripleRelease { suffixes: linux_suffixes_nopgo.clone(), install_only_suffix: "lto", - python_version_requirement: Some(VersionSpecifier::from_str(">=3.9").unwrap()), + python_version_requirement: Some(VersionSpecifier::from_str(">=3.10").unwrap()), conditional_suffixes: vec![ConditionalSuffixes { python_version_requirement: VersionSpecifier::from_str(">=3.13").unwrap(), suffixes: linux_suffixes_nopgo_freethreaded.clone(), @@ -196,7 +196,7 @@ pub static RELEASE_TRIPLES: Lazy> = Lazy:: TripleRelease { suffixes: linux_suffixes_nopgo.clone(), install_only_suffix: "lto", - python_version_requirement: Some(VersionSpecifier::from_str(">=3.9").unwrap()), + python_version_requirement: Some(VersionSpecifier::from_str(">=3.10").unwrap()), conditional_suffixes: vec![ConditionalSuffixes { python_version_requirement: VersionSpecifier::from_str(">=3.13").unwrap(), suffixes: linux_suffixes_nopgo_freethreaded.clone(), @@ -209,7 +209,7 @@ pub static RELEASE_TRIPLES: Lazy> = Lazy:: TripleRelease { suffixes: linux_suffixes_nopgo.clone(), install_only_suffix: "lto", - python_version_requirement: Some(VersionSpecifier::from_str(">=3.9").unwrap()), + python_version_requirement: Some(VersionSpecifier::from_str(">=3.10").unwrap()), conditional_suffixes: vec![ConditionalSuffixes { python_version_requirement: VersionSpecifier::from_str(">=3.13").unwrap(), suffixes: linux_suffixes_nopgo_freethreaded.clone(), @@ -222,7 +222,7 @@ pub static RELEASE_TRIPLES: Lazy> = Lazy:: TripleRelease { suffixes: linux_suffixes_nopgo.clone(), install_only_suffix: "lto", - python_version_requirement: Some(VersionSpecifier::from_str(">=3.9").unwrap()), + python_version_requirement: Some(VersionSpecifier::from_str(">=3.10").unwrap()), conditional_suffixes: vec![ConditionalSuffixes { python_version_requirement: VersionSpecifier::from_str(">=3.13").unwrap(), suffixes: linux_suffixes_nopgo_freethreaded.clone(), @@ -235,7 +235,7 @@ pub static RELEASE_TRIPLES: Lazy> = Lazy:: TripleRelease { suffixes: linux_suffixes_nopgo.clone(), install_only_suffix: "lto", - python_version_requirement: Some(VersionSpecifier::from_str(">=3.9").unwrap()), + python_version_requirement: Some(VersionSpecifier::from_str(">=3.10").unwrap()), conditional_suffixes: vec![ConditionalSuffixes { python_version_requirement: VersionSpecifier::from_str(">=3.13").unwrap(), suffixes: linux_suffixes_nopgo_freethreaded.clone(), @@ -260,7 +260,7 @@ pub static RELEASE_TRIPLES: Lazy> = Lazy:: TripleRelease { suffixes: linux_suffixes_pgo.clone(), install_only_suffix: "pgo+lto", - python_version_requirement: Some(VersionSpecifier::from_str(">=3.9").unwrap()), + python_version_requirement: Some(VersionSpecifier::from_str(">=3.10").unwrap()), conditional_suffixes: vec![ConditionalSuffixes { python_version_requirement: VersionSpecifier::from_str(">=3.13").unwrap(), suffixes: linux_suffixes_pgo_freethreaded.clone(), @@ -272,7 +272,7 @@ pub static RELEASE_TRIPLES: Lazy> = Lazy:: TripleRelease { suffixes: linux_suffixes_pgo.clone(), install_only_suffix: "pgo+lto", - python_version_requirement: Some(VersionSpecifier::from_str(">=3.9").unwrap()), + python_version_requirement: Some(VersionSpecifier::from_str(">=3.10").unwrap()), conditional_suffixes: vec![ConditionalSuffixes { python_version_requirement: VersionSpecifier::from_str(">=3.13").unwrap(), suffixes: linux_suffixes_pgo_freethreaded.clone(), @@ -284,7 +284,7 @@ pub static RELEASE_TRIPLES: Lazy> = Lazy:: TripleRelease { suffixes: linux_suffixes_pgo.clone(), install_only_suffix: "pgo+lto", - python_version_requirement: Some(VersionSpecifier::from_str(">=3.9").unwrap()), + python_version_requirement: Some(VersionSpecifier::from_str(">=3.10").unwrap()), conditional_suffixes: vec![ConditionalSuffixes { python_version_requirement: VersionSpecifier::from_str(">=3.13").unwrap(), suffixes: linux_suffixes_pgo_freethreaded.clone(), diff --git a/src/validation.rs b/src/validation.rs index 862b90d8e..9b4756fe2 100644 --- a/src/validation.rs +++ b/src/validation.rs @@ -32,13 +32,11 @@ use { const RECOGNIZED_TRIPLES: &[&str] = &[ "aarch64-apple-darwin", - "aarch64-apple-ios", "aarch64-pc-windows-msvc", "aarch64-unknown-linux-gnu", "aarch64-unknown-linux-musl", "armv7-unknown-linux-gnueabi", "armv7-unknown-linux-gnueabihf", - "arm64-apple-tvos", "i686-pc-windows-msvc", "i686-unknown-linux-gnu", // Note there's build support for mips* targets but they are not tested @@ -49,11 +47,7 @@ const RECOGNIZED_TRIPLES: &[&str] = &[ "ppc64le-unknown-linux-gnu", "riscv64-unknown-linux-gnu", "s390x-unknown-linux-gnu", - "thumbv7k-apple-watchos", "x86_64-apple-darwin", - "x86_64-apple-ios", - "x86_64-apple-tvos", - "x86_64-apple-watchos", "x86_64-pc-windows-msvc", "x86_64-unknown-linux-gnu", "x86_64_v2-unknown-linux-gnu", @@ -302,16 +296,6 @@ static ELF_ALLOWED_LIBRARIES_BY_MODULE: Lazy> = Lazy::new(|| { [ - MachOAllowedDylib { - name: "@executable_path/../lib/libpython3.9.dylib".to_string(), - max_compatibility_version: "3.9.0".try_into().unwrap(), - required: false, - }, - MachOAllowedDylib { - name: "@executable_path/../lib/libpython3.9d.dylib".to_string(), - max_compatibility_version: "3.9.0".try_into().unwrap(), - required: false, - }, MachOAllowedDylib { name: "@executable_path/../lib/libpython3.10.dylib".to_string(), max_compatibility_version: "3.10.0".try_into().unwrap(), @@ -503,59 +487,6 @@ static DARWIN_ALLOWED_DYLIBS: Lazy> = Lazy::new(|| { .to_vec() }); -static IOS_ALLOWED_DYLIBS: Lazy> = Lazy::new(|| { - [ - MachOAllowedDylib { - name: "@executable_path/../lib/libpython3.9.dylib".to_string(), - max_compatibility_version: "3.9.0".try_into().unwrap(), - required: false, - }, - MachOAllowedDylib { - name: "@executable_path/../lib/libpython3.9d.dylib".to_string(), - max_compatibility_version: "3.9.0".try_into().unwrap(), - required: false, - }, - MachOAllowedDylib { - name: "@executable_path/../lib/libpython3.10.dylib".to_string(), - max_compatibility_version: "3.10.0".try_into().unwrap(), - required: false, - }, - MachOAllowedDylib { - name: "@executable_path/../lib/libpython3.10d.dylib".to_string(), - max_compatibility_version: "3.10.0".try_into().unwrap(), - required: false, - }, - MachOAllowedDylib { - name: "@executable_path/../lib/libpython3.11.dylib".to_string(), - max_compatibility_version: "3.11.0".try_into().unwrap(), - required: false, - }, - MachOAllowedDylib { - name: "@executable_path/../lib/libpython3.11d.dylib".to_string(), - max_compatibility_version: "3.11.0".try_into().unwrap(), - required: false, - }, - // For some reason, CoreFoundation is present in debug/noopt builds but not - // LTO builds. - MachOAllowedDylib { - name: "/System/Library/Frameworks/CoreFoundation.framework/CoreFoundation".to_string(), - max_compatibility_version: "150.0.0".try_into().unwrap(), - required: false, - }, - MachOAllowedDylib { - name: "/usr/lib/libSystem.B.dylib".to_string(), - max_compatibility_version: "1.0.0".try_into().unwrap(), - required: true, - }, - MachOAllowedDylib { - name: "/usr/lib/libz.1.dylib".to_string(), - max_compatibility_version: "1.0.0".try_into().unwrap(), - required: true, - }, - ] - .to_vec() -}); - static ALLOWED_DYLIBS_BY_MODULE: Lazy>> = Lazy::new(|| { [( @@ -582,7 +513,6 @@ static ALLOWED_DYLIBS_BY_MODULE: Lazy> = Lazy::new(|| { [ ("aarch64-apple-darwin", "macosx-11.0-arm64"), - ("aarch64-apple-ios", "iOS-aarch64"), ("aarch64-pc-windows-msvc", "win-arm64"), ("aarch64-unknown-linux-gnu", "linux-aarch64"), ("aarch64-unknown-linux-musl", "linux-aarch64"), @@ -597,7 +527,6 @@ static PLATFORM_TAG_BY_TRIPLE: Lazy> = Lazy: ("riscv64-unknown-linux-gnu", "linux-riscv64"), ("s390x-unknown-linux-gnu", "linux-s390x"), ("x86_64-apple-darwin", "macosx-10.15-x86_64"), - ("x86_64-apple-ios", "iOS-x86_64"), ("x86_64-pc-windows-msvc", "win-amd64"), ("x86_64-unknown-linux-gnu", "linux-x86_64"), ("x86_64_v2-unknown-linux-gnu", "linux-x86_64"), @@ -746,6 +675,7 @@ const GLOBAL_EXTENSIONS: &[&str] = &[ "_json", "_locale", "_lsprof", + "_zoneinfo", "_lzma", "_md5", "_multibytecodec", @@ -794,8 +724,6 @@ const GLOBAL_EXTENSIONS: &[&str] = &[ "zlib", ]; -// _zoneinfo added in 3.9. -// parser removed in 3.10. // _tokenize added in 3.11. // _typing added in 3.11. // _testsinglephase added in 3.12. @@ -803,25 +731,11 @@ const GLOBAL_EXTENSIONS: &[&str] = &[ // _xxinterpchannels added in 3.12. // audioop removed in 3.13. -// We didn't build ctypes_test until 3.9. -// We didn't build some test extensions until 3.9. - -const GLOBAL_EXTENSIONS_PYTHON_3_9: &[&str] = &[ - "audioop", - "_peg_parser", - "_sha256", - "_sha512", - "_xxsubinterpreters", - "_zoneinfo", - "parser", -]; - const GLOBAL_EXTENSIONS_PYTHON_3_10: &[&str] = &[ "audioop", "_sha256", "_sha512", "_xxsubinterpreters", - "_zoneinfo", ]; const GLOBAL_EXTENSIONS_PYTHON_3_11: &[&str] = &[ @@ -831,7 +745,6 @@ const GLOBAL_EXTENSIONS_PYTHON_3_11: &[&str] = &[ "_tokenize", "_typing", "_xxsubinterpreters", - "_zoneinfo", ]; const GLOBAL_EXTENSIONS_PYTHON_3_12: &[&str] = &[ @@ -841,7 +754,6 @@ const GLOBAL_EXTENSIONS_PYTHON_3_12: &[&str] = &[ "_typing", "_xxinterpchannels", "_xxsubinterpreters", - "_zoneinfo", ]; const GLOBAL_EXTENSIONS_PYTHON_3_13: &[&str] = &[ @@ -853,7 +765,6 @@ const GLOBAL_EXTENSIONS_PYTHON_3_13: &[&str] = &[ "_sysconfig", "_tokenize", "_typing", - "_zoneinfo", ]; const GLOBAL_EXTENSIONS_PYTHON_3_14: &[&str] = &[ @@ -866,7 +777,6 @@ const GLOBAL_EXTENSIONS_PYTHON_3_14: &[&str] = &[ "_sysconfig", "_tokenize", "_typing", - "_zoneinfo", "_hmac", "_types", "_zstd", @@ -921,8 +831,6 @@ fn allowed_dylibs_for_triple(triple: &str) -> Vec { match triple { "aarch64-apple-darwin" => DARWIN_ALLOWED_DYLIBS.clone(), "x86_64-apple-darwin" => DARWIN_ALLOWED_DYLIBS.clone(), - "aarch64-apple-ios" => IOS_ALLOWED_DYLIBS.clone(), - "x86_64-apple-ios" => IOS_ALLOWED_DYLIBS.clone(), _ => vec![], } } @@ -1263,9 +1171,7 @@ fn validate_macho>( let wanted_cpu_type = match target_triple { "aarch64-apple-darwin" => object::macho::CPU_TYPE_ARM64, - "aarch64-apple-ios" => object::macho::CPU_TYPE_ARM64, "x86_64-apple-darwin" => object::macho::CPU_TYPE_X86_64, - "x86_64-apple-ios" => object::macho::CPU_TYPE_X86_64, _ => return Err(anyhow!("unhandled target triple: {}", target_triple)), }; @@ -1660,23 +1566,14 @@ fn validate_extension_modules( ) -> Result> { let mut errors = vec![]; - let is_ios = target_triple.contains("-apple-ios"); let is_macos = target_triple.contains("-apple-darwin"); let is_linux = target_triple.contains("-unknown-linux-"); let is_windows = target_triple.contains("-pc-windows-"); let is_linux_musl = target_triple.contains("-unknown-linux-musl"); - // iOS isn't well supported. So don't do any validation. - if is_ios { - return Ok(errors); - } - let mut wanted = BTreeSet::from_iter(GLOBAL_EXTENSIONS.iter().copied()); match python_major_minor { - "3.9" => { - wanted.extend(GLOBAL_EXTENSIONS_PYTHON_3_9); - } "3.10" => { wanted.extend(GLOBAL_EXTENSIONS_PYTHON_3_10); } @@ -1700,7 +1597,7 @@ fn validate_extension_modules( if is_macos { wanted.extend(GLOBAL_EXTENSIONS_POSIX); - if matches!(python_major_minor, "3.9" | "3.10" | "3.11" | "3.12") { + if matches!(python_major_minor, "3.10" | "3.11" | "3.12") { wanted.extend(GLOBAL_EXTENSIONS_POSIX_PRE_3_13); } @@ -1710,7 +1607,7 @@ fn validate_extension_modules( if is_windows { wanted.extend(GLOBAL_EXTENSIONS_WINDOWS); - if matches!(python_major_minor, "3.9" | "3.10" | "3.11" | "3.12") { + if matches!(python_major_minor, "3.10" | "3.11" | "3.12") { wanted.extend(GLOBAL_EXTENSIONS_WINDOWS_PRE_3_13); } @@ -1728,15 +1625,15 @@ fn validate_extension_modules( if is_linux { wanted.extend(GLOBAL_EXTENSIONS_POSIX); - if matches!(python_major_minor, "3.9" | "3.10" | "3.11" | "3.12") { + if matches!(python_major_minor, "3.10" | "3.11" | "3.12") { wanted.extend(GLOBAL_EXTENSIONS_POSIX_PRE_3_13); } - if matches!(python_major_minor, "3.9" | "3.10" | "3.11" | "3.12") { + if matches!(python_major_minor, "3.10" | "3.11" | "3.12") { wanted.extend(GLOBAL_EXTENSIONS_LINUX_PRE_3_13); } - if !is_linux_musl && matches!(python_major_minor, "3.9" | "3.10" | "3.11" | "3.12") { + if !is_linux_musl && matches!(python_major_minor, "3.10" | "3.11" | "3.12") { wanted.insert("ossaudiodev"); } } @@ -1868,9 +1765,7 @@ fn validate_distribution( ) })?; - let python_major_minor = if dist_filename.starts_with("cpython-3.9.") { - "3.9" - } else if dist_filename.starts_with("cpython-3.10.") { + let python_major_minor = if dist_filename.starts_with("cpython-3.10.") { "3.10" } else if dist_filename.starts_with("cpython-3.11.") { "3.11" @@ -2161,7 +2056,7 @@ fn validate_distribution( } else if name == "_warnings" { // But not on Python 3.13 on Windows if triple.contains("-windows-") { - matches!(python_major_minor, "3.9" | "3.10" | "3.11" | "3.12") + matches!(python_major_minor, "3.10" | "3.11" | "3.12") } else { true }