Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions ci-matrix.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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 {}
Expand Down Expand Up @@ -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":
Expand All @@ -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()
Expand Down Expand Up @@ -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 = []
Expand Down Expand Up @@ -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
Expand Down
22 changes: 1 addition & 21 deletions ci-targets.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ darwin:
aarch64-apple-darwin:
arch: aarch64
python_versions:
- "3.9"
- "3.10"
- "3.11"
- "3.12"
Expand All @@ -23,7 +22,6 @@ darwin:
x86_64-apple-darwin:
arch: x86_64
python_versions:
- "3.9"
- "3.10"
- "3.11"
- "3.12"
Expand All @@ -44,7 +42,6 @@ linux:
arch: aarch64
libc: gnu
python_versions:
- "3.9"
- "3.10"
- "3.11"
- "3.12"
Expand All @@ -64,7 +61,6 @@ linux:
arch: armv7
libc: gnu
python_versions:
- "3.9"
- "3.10"
- "3.11"
- "3.12"
Expand All @@ -86,7 +82,6 @@ linux:
arch: armv7
libc: gnu
python_versions:
- "3.9"
- "3.10"
- "3.11"
- "3.12"
Expand All @@ -108,7 +103,6 @@ linux:
arch: s390x
libc: gnu
python_versions:
- "3.9"
- "3.10"
- "3.11"
- "3.12"
Expand All @@ -130,7 +124,6 @@ linux:
arch: ppc64le
libc: gnu
python_versions:
- "3.9"
- "3.10"
- "3.11"
- "3.12"
Expand All @@ -152,7 +145,6 @@ linux:
arch: riscv64
libc: gnu
python_versions:
- "3.9"
- "3.10"
- "3.11"
- "3.12"
Expand All @@ -174,7 +166,6 @@ linux:
arch: x86_64
libc: gnu
python_versions:
- "3.9"
- "3.10"
- "3.11"
- "3.12"
Expand All @@ -196,7 +187,6 @@ linux:
arch_variant: v2
libc: gnu
python_versions:
- "3.9"
- "3.10"
- "3.11"
- "3.12"
Expand All @@ -218,7 +208,6 @@ linux:
arch_variant: v3
libc: gnu
python_versions:
- "3.9"
- "3.10"
- "3.11"
- "3.12"
Expand All @@ -240,7 +229,6 @@ linux:
arch_variant: v4
libc: gnu
python_versions:
- "3.9"
- "3.10"
- "3.11"
- "3.12"
Expand All @@ -261,7 +249,6 @@ linux:
arch: x86_64
libc: musl
python_versions:
- "3.9"
- "3.10"
- "3.11"
- "3.12"
Expand All @@ -288,7 +275,6 @@ linux:
arch_variant: v2
libc: musl
python_versions:
- "3.9"
- "3.10"
- "3.11"
- "3.12"
Expand All @@ -315,7 +301,6 @@ linux:
arch_variant: v3
libc: musl
python_versions:
- "3.9"
- "3.10"
- "3.11"
- "3.12"
Expand All @@ -342,7 +327,6 @@ linux:
arch_variant: v4
libc: musl
python_versions:
- "3.9"
- "3.10"
- "3.11"
- "3.12"
Expand All @@ -368,7 +352,6 @@ linux:
arch: aarch64
libc: musl
python_versions:
- "3.9"
- "3.10"
- "3.11"
- "3.12"
Expand Down Expand Up @@ -396,7 +379,6 @@ windows:
arch: x86
vcvars: vcvars32.bat
python_versions:
- "3.9"
- "3.10"
- "3.11"
- "3.12"
Expand All @@ -414,7 +396,6 @@ windows:
arch: x86_64
vcvars: vcvars64.bat
python_versions:
- "3.9"
- "3.10"
- "3.11"
- "3.12"
Expand All @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion cpython-unix/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
79 changes: 4 additions & 75 deletions cpython-unix/build-cpython.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -205,43 +196,19 @@ 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
# non-dynamic binaries. Patch Python to work around this.
# 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
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down
1 change: 0 additions & 1 deletion cpython-unix/build-main.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@ def main():
parser.add_argument(
"--python",
choices={
"cpython-3.9",
"cpython-3.10",
"cpython-3.11",
"cpython-3.12",
Expand Down
6 changes: 0 additions & 6 deletions cpython-unix/build-sqlite.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
Loading