From 525093df5c8e6a28295565b895ef010f6811f473 Mon Sep 17 00:00:00 2001 From: Zanie Blue Date: Tue, 8 Apr 2025 13:45:46 -0500 Subject: [PATCH 1/7] Bump to 3.14.0a7 --- pythonbuild/downloads.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/pythonbuild/downloads.py b/pythonbuild/downloads.py index 89f3ce08..7bb6cbd6 100644 --- a/pythonbuild/downloads.py +++ b/pythonbuild/downloads.py @@ -82,10 +82,10 @@ "python_tag": "cp313", }, "cpython-3.14": { - "url": "https://www.python.org/ftp/python/3.14.0/Python-3.14.0a6.tar.xz", - "size": 22956068, - "sha256": "8d6181e5331d9a2cd6ca405ae1230e88589a043f4768ebb443d3889d45c1c35c", - "version": "3.14.0a6", + "url": "https://www.python.org/ftp/python/3.14.0/Python-3.14.0a7.tar.xz", + "size": 23015952, + "sha256": "71adbcec3ac9edf93308e55cfb4184f2eb4b16fda2bb0a5a382929ed29c8386d", + "version": "3.14.0a7", "licenses": ["Python-2.0", "CNRI-Python"], "license_file": "LICENSE.cpython.txt", "python_tag": "cp314", From 3a72586cb0dbc10d5568837473382734cc1c4dac Mon Sep 17 00:00:00 2001 From: Zanie Blue Date: Wed, 9 Apr 2025 08:52:14 -0500 Subject: [PATCH 2/7] Add minimal definitions for new extension modules --- cpython-unix/extension-modules.yml | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/cpython-unix/extension-modules.yml b/cpython-unix/extension-modules.yml index a8ff460f..396386f8 100644 --- a/cpython-unix/extension-modules.yml +++ b/cpython-unix/extension-modules.yml @@ -311,6 +311,13 @@ _heapq: sources: - _heapqmodule.c +_hmac: + minimum-python-version: '3.14' + sources: + - hmacmodule.c + includes: + - Modules/_hacl/include + _imp: config-c-only: true @@ -700,6 +707,11 @@ _tracemalloc: required-targets: - .* +_types: + minimum-python-version: "3.14" + sources: + - _typesmodule.c + _typing: minimum-python-version: "3.11" setup-enabled-conditional: From d57fd69fa149dc03ea6e0dfc8db561241c76751d Mon Sep 17 00:00:00 2001 From: Zanie Blue Date: Wed, 9 Apr 2025 09:50:16 -0500 Subject: [PATCH 3/7] Add setup-enabled annotation --- cpython-unix/extension-modules.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/cpython-unix/extension-modules.yml b/cpython-unix/extension-modules.yml index 396386f8..4d8bc406 100644 --- a/cpython-unix/extension-modules.yml +++ b/cpython-unix/extension-modules.yml @@ -709,6 +709,7 @@ _tracemalloc: _types: minimum-python-version: "3.14" + setup-enabled: true sources: - _typesmodule.c From 13448e6d8b435925c67bd70bab0999c7079f7317 Mon Sep 17 00:00:00 2001 From: Zanie Blue Date: Wed, 9 Apr 2025 09:59:50 -0500 Subject: [PATCH 4/7] Toggle zlib to zlib-ng on 3.14+ --- cpython-windows/build.py | 18 +++++++++++++++--- pythonbuild/downloads.py | 9 +++++++++ 2 files changed, 24 insertions(+), 3 deletions(-) diff --git a/cpython-windows/build.py b/cpython-windows/build.py index 7e4d78ac..fd81f933 100644 --- a/cpython-windows/build.py +++ b/cpython-windows/build.py @@ -346,16 +346,18 @@ def hack_props( pcbuild_path: pathlib.Path, arch: str, python_version: str, + zlib_entry: str ): # TODO can we pass props into msbuild.exe? # Our dependencies are in different directories from what CPython's # build system expects. Modify the config file appropriately. + bzip2_version = DOWNLOADS["bzip2"]["version"] sqlite_version = DOWNLOADS["sqlite"]["version"] xz_version = DOWNLOADS["xz"]["version"] - zlib_version = DOWNLOADS["zlib"]["version"] + zlib_version = DOWNLOADS[zlib_entry]["version"] mpdecimal_version = DOWNLOADS["mpdecimal"]["version"] @@ -369,7 +371,7 @@ def hack_props( libffi_path = td / "libffi" tcltk_path = td / ("cpython-bin-deps-%s" % tcltk_commit) xz_path = td / ("xz-%s" % xz_version) - zlib_path = td / ("zlib-%s" % zlib_version) + zlib_path = td / ("%s-%s" % (zlib_entry, zlib_version)) mpdecimal_path = td / ("mpdecimal-%s" % mpdecimal_version) openssl_root = td / "openssl" / arch @@ -484,6 +486,7 @@ def hack_project_files( cpython_source_path: pathlib.Path, build_directory: str, python_version: str, + zlib_entry: str ): """Hacks Visual Studio project files to work with our build.""" @@ -494,6 +497,7 @@ def hack_project_files( pcbuild_path, build_directory, python_version, + zlib_entry, ) # Our SQLite directory is named weirdly. This throws off version detection @@ -913,6 +917,7 @@ def collect_python_build_artifacts( arch: str, config: str, openssl_entry: str, + zlib_entry: str, freethreaded: bool, ): """Collect build artifacts from Python. @@ -1142,6 +1147,9 @@ def find_additional_dependencies(project: pathlib.Path): if name == "openssl": name = openssl_entry + if name == "zlib": + name = zlib_entry + # On 3.14+, we use the latest tcl/tk version if ext == "_tkinter" and python_majmin == "314": name = name.replace("-8612", "") @@ -1213,10 +1221,12 @@ def build_cpython( # The python.props file keys off MSBUILD, so it needs to be set. os.environ["MSBUILD"] = str(msbuild) + zlib_entry = "zlib-ng" if meets_python_minimum_version("3.14") else "zlib" + bzip2_archive = download_entry("bzip2", BUILD) sqlite_archive = download_entry("sqlite", BUILD) xz_archive = download_entry("xz", BUILD) - zlib_archive = download_entry("zlib", BUILD) + zlib_archive = download_entry(zlib_entry, BUILD) python_archive = download_entry(python_entry_name, BUILD) entry = DOWNLOADS[python_entry_name] @@ -1328,6 +1338,7 @@ def build_cpython( cpython_source_path, build_directory, python_version=python_version, + zlib_entry=zlib_entry, ) if pgo: @@ -1528,6 +1539,7 @@ def build_cpython( build_directory, artifact_config, openssl_entry=openssl_entry, + zlib_entry=zlib_entry, freethreaded=freethreaded, ) diff --git a/pythonbuild/downloads.py b/pythonbuild/downloads.py index 7bb6cbd6..6954efa6 100644 --- a/pythonbuild/downloads.py +++ b/pythonbuild/downloads.py @@ -446,4 +446,13 @@ "licenses": ["Zlib"], "license_file": "LICENSE.zlib.txt", }, + "zlib-ng": { + "url": "https://github.com/python/cpython-source-deps/archive/refs/tags/zlib-ng-2.2.4.tar.gz", + "size": 2415819, + "sha256": "00bbd88709bc416cb96160ab61d3e1c8f76e106799af7328d0fe434dc7dd5004", + "version": "2.2.4", + "library_names": ["z"], + "licenses": ["Zlib"], + "license_file": "LICENSE.zlib-ng.txt", + } } From 559abb85a02a5916cf30272fd08aabe23d7c8814 Mon Sep 17 00:00:00 2001 From: Zanie Blue Date: Wed, 9 Apr 2025 11:15:53 -0500 Subject: [PATCH 5/7] Poke at hmac definition --- cpython-unix/extension-modules.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/cpython-unix/extension-modules.yml b/cpython-unix/extension-modules.yml index 4d8bc406..ca9e166c 100644 --- a/cpython-unix/extension-modules.yml +++ b/cpython-unix/extension-modules.yml @@ -316,7 +316,9 @@ _hmac: sources: - hmacmodule.c includes: - - Modules/_hacl/include + - Modules/_hacl + links: + - :libHacl_Hash_Blake2.a _imp: config-c-only: true From 9727665f5e0b06b33986d912c4cef3e30d8a3a46 Mon Sep 17 00:00:00 2001 From: Zanie Blue Date: Wed, 9 Apr 2025 12:48:27 -0500 Subject: [PATCH 6/7] Fix Python version --- cpython-windows/build.py | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/cpython-windows/build.py b/cpython-windows/build.py index fd81f933..0c0b4ac5 100644 --- a/cpython-windows/build.py +++ b/cpython-windows/build.py @@ -1221,18 +1221,17 @@ def build_cpython( # The python.props file keys off MSBUILD, so it needs to be set. os.environ["MSBUILD"] = str(msbuild) - zlib_entry = "zlib-ng" if meets_python_minimum_version("3.14") else "zlib" + python_archive = download_entry(python_entry_name, BUILD) + entry = DOWNLOADS[python_entry_name] + python_version = entry["version"] + + zlib_entry = "zlib-ng" if meets_python_minimum_version(python_version, "3.14") else "zlib" bzip2_archive = download_entry("bzip2", BUILD) sqlite_archive = download_entry("sqlite", BUILD) xz_archive = download_entry("xz", BUILD) zlib_archive = download_entry(zlib_entry, BUILD) - python_archive = download_entry(python_entry_name, BUILD) - entry = DOWNLOADS[python_entry_name] - - python_version = entry["version"] - setuptools_wheel = download_entry("setuptools", BUILD) pip_wheel = download_entry("pip", BUILD) From 86cd696b624e9106ac92290b63ad6b360ceb7f6a Mon Sep 17 00:00:00 2001 From: Zanie Blue Date: Wed, 9 Apr 2025 12:48:40 -0500 Subject: [PATCH 7/7] Format --- cpython-windows/build.py | 9 +++++---- pythonbuild/downloads.py | 4 ++-- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/cpython-windows/build.py b/cpython-windows/build.py index 0c0b4ac5..a9d82bef 100644 --- a/cpython-windows/build.py +++ b/cpython-windows/build.py @@ -346,14 +346,13 @@ def hack_props( pcbuild_path: pathlib.Path, arch: str, python_version: str, - zlib_entry: str + zlib_entry: str, ): # TODO can we pass props into msbuild.exe? # Our dependencies are in different directories from what CPython's # build system expects. Modify the config file appropriately. - bzip2_version = DOWNLOADS["bzip2"]["version"] sqlite_version = DOWNLOADS["sqlite"]["version"] xz_version = DOWNLOADS["xz"]["version"] @@ -486,7 +485,7 @@ def hack_project_files( cpython_source_path: pathlib.Path, build_directory: str, python_version: str, - zlib_entry: str + zlib_entry: str, ): """Hacks Visual Studio project files to work with our build.""" @@ -1225,7 +1224,9 @@ def build_cpython( entry = DOWNLOADS[python_entry_name] python_version = entry["version"] - zlib_entry = "zlib-ng" if meets_python_minimum_version(python_version, "3.14") else "zlib" + zlib_entry = ( + "zlib-ng" if meets_python_minimum_version(python_version, "3.14") else "zlib" + ) bzip2_archive = download_entry("bzip2", BUILD) sqlite_archive = download_entry("sqlite", BUILD) diff --git a/pythonbuild/downloads.py b/pythonbuild/downloads.py index 6954efa6..8a5bb89f 100644 --- a/pythonbuild/downloads.py +++ b/pythonbuild/downloads.py @@ -448,11 +448,11 @@ }, "zlib-ng": { "url": "https://github.com/python/cpython-source-deps/archive/refs/tags/zlib-ng-2.2.4.tar.gz", - "size": 2415819, + "size": 2415819, "sha256": "00bbd88709bc416cb96160ab61d3e1c8f76e106799af7328d0fe434dc7dd5004", "version": "2.2.4", "library_names": ["z"], "licenses": ["Zlib"], "license_file": "LICENSE.zlib-ng.txt", - } + }, }