From f80dc1ff9c77c918cb12f3d0aecd890c7aa6120d Mon Sep 17 00:00:00 2001 From: Zanie Blue Date: Mon, 14 Apr 2025 18:54:43 -0500 Subject: [PATCH 01/18] Add ARM64 builds for Windows Co-authored-by: Adrian Antkowiak --- ci-runners.yaml | 5 ++++ ci-targets.yaml | 17 +++++++++++++ cpython-windows/build.py | 53 ++++++++++++++++++++++++++++++++++------ 3 files changed, 68 insertions(+), 7 deletions(-) diff --git a/ci-runners.yaml b/ci-runners.yaml index aeb0e5ca0..27a3b84e5 100644 --- a/ci-runners.yaml +++ b/ci-runners.yaml @@ -35,3 +35,8 @@ windows-latest: arch: x86_64 platform: windows free: true + +windows-11-arm: + arch: aarch64 + platform: windows + free: false diff --git a/ci-targets.yaml b/ci-targets.yaml index 70078e87c..20b5be53f 100644 --- a/ci-targets.yaml +++ b/ci-targets.yaml @@ -384,3 +384,20 @@ windows: - options: - freethreaded+pgo minimum-python-version: "3.13" + + aarch64-pc-windows-msvc: + arch: aarch64 + vcvars: vcvarsamd64_arm64.bat + python_versions: + - "3.9" + - "3.10" + - "3.11" + - "3.12" + - "3.13" + - "3.14" + build_options: + - pgo + build_options_conditional: + - options: + - freethreaded+pgo + minimum-python-version: "3.13" diff --git a/cpython-windows/build.py b/cpython-windows/build.py index 15b0a44de..4193d8f57 100644 --- a/cpython-windows/build.py +++ b/cpython-windows/build.py @@ -464,6 +464,8 @@ def hack_props( suffix = b"-x64" elif arch == "win32": suffix = b"" + elif arch == "arm64": + suffix = b"" else: raise Exception("unhandled architecture: %s" % arch) @@ -730,9 +732,11 @@ def build_openssl_for_arch( elif arch == "amd64": configure = "VC-WIN64A" prefix = "64" + elif arch == "arm64": + configure = "VC-WIN64-ARM" + prefix = "arm64" else: - print("invalid architecture: %s" % arch) - sys.exit(1) + raise Exception("unhandled architecture: %s" % arch) # The official CPython OpenSSL builds hack ms/uplink.c to change the # ``GetModuleHandle(NULL)`` invocation to load things from _ssl.pyd @@ -780,6 +784,12 @@ def build_openssl_for_arch( log("copying %s to %s" % (source, dest)) shutil.copyfile(source, dest) + # Copy `applink.c` to the include directory. + source_applink = source_root / "ms" / "applink.c" + dest_applink = install_root / "include" / "openssl" / "applink.c" + log("copying %s to %s" % (source_applink, dest_applink)) + shutil.copyfile(source_applink, dest_applink) + def build_openssl( entry: str, @@ -801,6 +811,7 @@ def build_openssl( root_32 = td / "x86" root_64 = td / "x64" + root_arm64 = td / "arm64" if arch == "x86": root_32.mkdir() @@ -824,13 +835,28 @@ def build_openssl( root_64, jom_archive=jom_archive, ) + elif arch == "arm64": + root_arm64.mkdir() + build_openssl_for_arch( + perl_path, + "arm64", + openssl_archive, + openssl_version, + nasm_archive, + root_arm64, + jom_archive=jom_archive, + ) else: - raise ValueError("unhandled arch: %s" % arch) + raise Exception("unhandled architecture: %s" % arch) install = td / "out" if arch == "x86": shutil.copytree(root_32 / "install" / "32", install / "openssl" / "win32") + elif arch == "arm64": + shutil.copytree( + root_arm64 / "install" / "arm64", install / "openssl" / "arm64" + ) else: shutil.copytree(root_64 / "install" / "64", install / "openssl" / "amd64") @@ -901,9 +927,14 @@ def build_libffi( if arch == "x86": args.append("-x86") artifacts_path = ffi_source_path / "i686-pc-cygwin" - else: + elif arch == "arm64": + args.append("-arm64") + artifacts_path = ffi_source_path / "aarch64-w64-cygwin" + elif arch == "amd64": args.append("-x64") artifacts_path = ffi_source_path / "x86_64-w64-cygwin" + else: + raise Exception("unhandled architecture: %s" % arch) subprocess.run(args, env=env, check=True) @@ -1297,8 +1328,11 @@ def build_cpython( elif arch == "x86": build_platform = "win32" build_directory = "win32" + elif arch == "arm64": + build_platform = "arm64" + build_directory = "arm64" else: - raise ValueError("unhandled arch: %s" % arch) + raise Exception("unhandled architecture: %s" % arch) tempdir_opts = ( {"ignore_cleanup_errors": True} if sys.version_info >= (3, 12) else {} @@ -1332,7 +1366,7 @@ def build_cpython( # We need all the OpenSSL library files in the same directory to appease # install rules. - openssl_arch = {"amd64": "amd64", "x86": "win32"}[arch] + openssl_arch = {"amd64": "amd64", "x86": "win32", "arm64": "arm64"}[arch] openssl_root = td / "openssl" / openssl_arch openssl_bin_path = openssl_root / "bin" openssl_lib_path = openssl_root / "lib" @@ -1790,9 +1824,14 @@ def main() -> None: if os.environ.get("Platform") == "x86": target_triple = "i686-pc-windows-msvc" arch = "x86" - else: + elif os.environ.get("Platform") == "arm64": + target_triple = "aarch64-pc-windows-msvc" + arch = "arm64" + elif os.environ.get("Platform") == "x64": target_triple = "x86_64-pc-windows-msvc" arch = "amd64" + else: + raise Exception("unhandled architecture: %s" % os.environ.get("Platform")) # TODO need better dependency checking. From 56339b6dc63e30ccf64ba0e8115e0a6a9ac9b183 Mon Sep 17 00:00:00 2001 From: Zanie Blue Date: Tue, 15 Apr 2025 19:33:17 -0500 Subject: [PATCH 02/18] Add `arm64` to `collect_python_build_artifacts` --- cpython-windows/build.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/cpython-windows/build.py b/cpython-windows/build.py index 4193d8f57..8b1fa3e62 100644 --- a/cpython-windows/build.py +++ b/cpython-windows/build.py @@ -1100,6 +1100,8 @@ def find_additional_dependencies(project: pathlib.Path): abi_platform = "win_amd64" elif arch == "win32": abi_platform = "win32" + elif arch == "arm64": + abi_platform = "arm64" else: raise ValueError("unhandled arch: %s" % arch) From 6b8d80c9da21aac882333b59e59206a45148ed39 Mon Sep 17 00:00:00 2001 From: Zanie Blue Date: Mon, 16 Jun 2025 13:55:43 -0500 Subject: [PATCH 03/18] Use the newer tcl-tk bin for arm64 builds --- cpython-windows/build.py | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/cpython-windows/build.py b/cpython-windows/build.py index 8b1fa3e62..6277a7353 100644 --- a/cpython-windows/build.py +++ b/cpython-windows/build.py @@ -370,7 +370,7 @@ def hack_props( mpdecimal_version = DOWNLOADS["mpdecimal"]["version"] - if meets_python_minimum_version(python_version, "3.14"): + if meets_python_minimum_version(python_version, "3.14") or arch == "arm64": tcltk_commit = DOWNLOADS["tk-windows-bin"]["git_commit"] else: tcltk_commit = DOWNLOADS["tk-windows-bin-8612"]["git_commit"] @@ -507,6 +507,7 @@ def hack_project_files( build_directory: str, python_version: str, zlib_entry: str, + arch: str, ): """Hacks Visual Studio project files to work with our build.""" @@ -605,9 +606,10 @@ def hack_project_files( # have a standalone zlib DLL, so we remove references to it. For Python # 3.14+, we're using tk-windows-bin 8.6.14 which includes a prebuilt zlib # DLL, so we skip this patch there. - if meets_python_minimum_version( - python_version, "3.12" - ) and meets_python_maximum_version(python_version, "3.13"): + # On arm64, we use the new version of tk-windows-bin for all versions. + if meets_python_minimum_version(python_version, "3.12") and ( + meets_python_maximum_version(python_version, "3.13") or arch == "arm64" + ): static_replace_in_file( pcbuild_path / "_tkinter.vcxproj", rb'<_TclTkDLL Include="$(tcltkdir)\bin\$(tclZlibDllName)" />', @@ -1203,9 +1205,9 @@ def find_additional_dependencies(project: pathlib.Path): if name == "zlib": name = zlib_entry - - # On 3.14+, we use the latest tcl/tk version - if ext == "_tkinter" and python_majmin == "314": +: + # On 3.14+ and aarch64, we use the latest tcl/tk version + if ext == "_tkinter" and (python_majmin == "314" or arch == "arm64"): name = name.replace("-8612", "") download_entry = DOWNLOADS[name] @@ -1291,9 +1293,11 @@ def build_cpython( setuptools_wheel = download_entry("setuptools", BUILD) pip_wheel = download_entry("pip", BUILD) - # On CPython 3.14+, we use the latest tcl/tk version which has additional runtime - # dependencies, so we are conservative and use the old version elsewhere. - if meets_python_minimum_version(python_version, "3.14"): + # On CPython 3.14+, we use the latest tcl/tk version which has additional + # runtime dependencies, so we are conservative and use the old version + # elsewhere. The old version isn't built for arm64, so we use the new + # version there too + if meets_python_minimum_version(python_version, "3.14") or arch == "arm64": tk_bin_archive = download_entry( "tk-windows-bin", BUILD, local_name="tk-windows-bin.tar.gz" ) @@ -1404,6 +1408,7 @@ def build_cpython( build_directory, python_version=python_version, zlib_entry=zlib_entry, + arch=arch, ) if pgo: From 66b7be1f9f3dcf203405a508a5beddd3f0d91c24 Mon Sep 17 00:00:00 2001 From: Zanie Blue Date: Wed, 16 Apr 2025 08:46:49 -0500 Subject: [PATCH 04/18] Add recognized triple --- src/validation.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/validation.rs b/src/validation.rs index 19aace00d..62233aff3 100644 --- a/src/validation.rs +++ b/src/validation.rs @@ -33,6 +33,7 @@ use { const RECOGNIZED_TRIPLES: &[&str] = &[ "aarch64-apple-darwin", "aarch64-apple-ios", + "aarch64-pc-windows-msvc", "aarch64-unknown-linux-gnu", "armv7-unknown-linux-gnueabi", "armv7-unknown-linux-gnueabihf", From c539516446c162fa7e4e62e3a9e72de77f8d4b0f Mon Sep 17 00:00:00 2001 From: Zanie Blue Date: Wed, 16 Apr 2025 08:49:20 -0500 Subject: [PATCH 05/18] All Tcl/Tk patch to fail --- cpython-windows/build.py | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/cpython-windows/build.py b/cpython-windows/build.py index 6277a7353..eda719b76 100644 --- a/cpython-windows/build.py +++ b/cpython-windows/build.py @@ -610,11 +610,14 @@ def hack_project_files( if meets_python_minimum_version(python_version, "3.12") and ( meets_python_maximum_version(python_version, "3.13") or arch == "arm64" ): - static_replace_in_file( - pcbuild_path / "_tkinter.vcxproj", - rb'<_TclTkDLL Include="$(tcltkdir)\bin\$(tclZlibDllName)" />', - rb"", - ) + try: + static_replace_in_file( + pcbuild_path / "_tkinter.vcxproj", + rb'<_TclTkDLL Include="$(tcltkdir)\bin\$(tclZlibDllName)" />', + rb"", + ) + except NoSearchStringError: + pass # We don't need to produce python_uwp.exe and its *w variant. Or the # python3.dll, pyshellext, or pylauncher. From 527957b89aed0cefbe3e7e8287643d087764bc5a Mon Sep 17 00:00:00 2001 From: Zanie Blue Date: Wed, 16 Apr 2025 08:49:45 -0500 Subject: [PATCH 06/18] Update abi platform --- cpython-windows/build.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cpython-windows/build.py b/cpython-windows/build.py index eda719b76..8aa75a583 100644 --- a/cpython-windows/build.py +++ b/cpython-windows/build.py @@ -1106,7 +1106,7 @@ def find_additional_dependencies(project: pathlib.Path): elif arch == "win32": abi_platform = "win32" elif arch == "arm64": - abi_platform = "arm64" + abi_platform = "win__arm64" else: raise ValueError("unhandled arch: %s" % arch) From aa7e8e7c29a7f053456265b81822aa8e6c77d3d5 Mon Sep 17 00:00:00 2001 From: Zanie Blue Date: Wed, 16 Apr 2025 09:01:30 -0500 Subject: [PATCH 07/18] Disable 3.9 / 3.10 --- ci-targets.yaml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/ci-targets.yaml b/ci-targets.yaml index 20b5be53f..c7b4bd12d 100644 --- a/ci-targets.yaml +++ b/ci-targets.yaml @@ -389,8 +389,9 @@ windows: arch: aarch64 vcvars: vcvarsamd64_arm64.bat python_versions: - - "3.9" - - "3.10" + # On 3.9 / 3.10, `_tkinter` is failing to be included in the build + # - "3.9" + # - "3.10" - "3.11" - "3.12" - "3.13" From 140bd7950bae2794be3ae61fe6a908ea9482da46 Mon Sep 17 00:00:00 2001 From: Zanie Blue Date: Wed, 16 Apr 2025 11:31:28 -0500 Subject: [PATCH 08/18] Add platformt ag entry --- src/validation.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/validation.rs b/src/validation.rs index 62233aff3..856b30de7 100644 --- a/src/validation.rs +++ b/src/validation.rs @@ -497,6 +497,7 @@ static PLATFORM_TAG_BY_TRIPLE: Lazy> = Lazy: [ ("aarch64-apple-darwin", "macosx-11.0-arm64"), ("aarch64-apple-ios", "iOS-aarch64"), + ("aarch64-pc-windows-msvc", "win-arm64"), ("aarch64-unknown-linux-gnu", "linux-aarch64"), ("armv7-unknown-linux-gnueabi", "linux-arm"), ("armv7-unknown-linux-gnueabihf", "linux-arm"), From 137ba571d39fc9a65313a9a9fa4b80d6e07239b4 Mon Sep 17 00:00:00 2001 From: Zanie Blue Date: Wed, 16 Apr 2025 12:52:14 -0500 Subject: [PATCH 09/18] Update validation for arm64 --- src/validation.rs | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/src/validation.rs b/src/validation.rs index 856b30de7..8f9858167 100644 --- a/src/validation.rs +++ b/src/validation.rs @@ -18,7 +18,7 @@ use { macho::{LoadCommandVariant, MachHeader, Nlist}, pe::{ImageNtHeaders, PeFile, PeFile32, PeFile64}, }, - Endianness, FileKind, Object, SectionIndex, SymbolScope, + Architecture, Endianness, FileKind, Object, SectionIndex, SymbolScope, }, once_cell::sync::Lazy, std::{ @@ -118,6 +118,7 @@ const PE_ALLOWED_LIBRARIES: &[&str] = &[ "libcrypto-1_1.dll", "libcrypto-1_1-x64.dll", "libcrypto-3.dll", + "libcrypto-3-arm64.dll", "libcrypto-3-x64.dll", "libffi-8.dll", "libssl-1_1.dll", @@ -138,8 +139,9 @@ const PE_ALLOWED_LIBRARIES: &[&str] = &[ "tk86t.dll", ]; -// CPython 3.14 uses tcl/tk 8.6.14+ which includes a bundled zlib and dynamically links to msvcrt. +// CPython 3.14 and ARM64 use tcl/tk 8.6.14+ which includes a bundled zlib and dynamically links to msvcrt. const PE_ALLOWED_LIBRARIES_314: &[&str] = &["msvcrt.dll", "zlib1.dll"]; +const PE_ALLOWED_LIBRARIES_ARM64: &[&str] = &["msvcrt.dll", "zlib1.dll"]; static GLIBC_MAX_VERSION_BY_TRIPLE: Lazy>> = Lazy::new(|| { @@ -1377,15 +1379,17 @@ fn validate_pe<'data, Pe: ImageNtHeaders>( let lib = String::from_utf8(lib.to_vec())?; match python_major_minor { - "3.9" | "3.10" | "3.11" | "3.12" | "3.13" => {} + "3.11" | "3.12" | "3.13" if pe.architecture() == Architecture::Aarch64 => { + if PE_ALLOWED_LIBRARIES_ARM64.contains(&lib.as_str()) { + continue; + } + } "3.14" => { if PE_ALLOWED_LIBRARIES_314.contains(&lib.as_str()) { continue; } } - _ => { - panic!("unhandled Python version: {}", python_major_minor); - } + _ => {} } if !PE_ALLOWED_LIBRARIES.contains(&lib.as_str()) { From 8f6311b4f2f0ccdb4e967fea11e7bf1193c1d0ac Mon Sep 17 00:00:00 2001 From: Zanie Blue Date: Wed, 16 Apr 2025 13:51:38 -0500 Subject: [PATCH 10/18] Allow arm64 libssl --- src/validation.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/validation.rs b/src/validation.rs index 8f9858167..294ed93df 100644 --- a/src/validation.rs +++ b/src/validation.rs @@ -124,6 +124,7 @@ const PE_ALLOWED_LIBRARIES: &[&str] = &[ "libssl-1_1.dll", "libssl-1_1-x64.dll", "libssl-3.dll", + "libssl-3-arm64.dll", "libssl-3-x64.dll", "python3.dll", "python39.dll", From 238f27cd3b9e0e64256a84f109f0c5ef0c6a3ecd Mon Sep 17 00:00:00 2001 From: Zanie Blue Date: Wed, 16 Apr 2025 13:52:22 -0500 Subject: [PATCH 11/18] Fix double underscore --- cpython-windows/build.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cpython-windows/build.py b/cpython-windows/build.py index 8aa75a583..62b8f1287 100644 --- a/cpython-windows/build.py +++ b/cpython-windows/build.py @@ -1106,7 +1106,7 @@ def find_additional_dependencies(project: pathlib.Path): elif arch == "win32": abi_platform = "win32" elif arch == "arm64": - abi_platform = "win__arm64" + abi_platform = "win_arm64" else: raise ValueError("unhandled arch: %s" % arch) From b76ccc0f4a793c452cceaef1d0374d431208c5dc Mon Sep 17 00:00:00 2001 From: Zanie Blue Date: Wed, 16 Apr 2025 14:08:45 -0500 Subject: [PATCH 12/18] Add timeout to jobs --- .github/workflows/windows.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/windows.yml b/.github/workflows/windows.yml index a7535c686..ad8bbfe3d 100644 --- a/.github/workflows/windows.yml +++ b/.github/workflows/windows.yml @@ -92,6 +92,7 @@ jobs: fi build: + timeout-minutes: 60 needs: - generate-matrix - pythonbuild From 4323f7da4869ecee489632289d99913cee2a3dfe Mon Sep 17 00:00:00 2001 From: Zanie Blue Date: Mon, 13 Jan 2025 15:02:41 -0600 Subject: [PATCH 13/18] Delete `x86_64-w64-mingw32-nmakehlp.exe` from tcltk --- cpython-windows/build.py | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/cpython-windows/build.py b/cpython-windows/build.py index 62b8f1287..99ea2c0b3 100644 --- a/cpython-windows/build.py +++ b/cpython-windows/build.py @@ -1300,14 +1300,10 @@ def build_cpython( # runtime dependencies, so we are conservative and use the old version # elsewhere. The old version isn't built for arm64, so we use the new # version there too - if meets_python_minimum_version(python_version, "3.14") or arch == "arm64": - tk_bin_archive = download_entry( - "tk-windows-bin", BUILD, local_name="tk-windows-bin.tar.gz" - ) - else: - tk_bin_archive = download_entry( - "tk-windows-bin-8612", BUILD, local_name="tk-windows-bin.tar.gz" - ) + tk_bin_entry = "tk-windows-bin" if meets_python_minimum_version(python_version, "3.14") or arch == "arm64" else "tk-windows-bin-8612" + tk_bin_archive = download_entry( + tk_bin_entry, BUILD, local_name="tk-windows-bin.tar.gz" + ) # On CPython 3.14+, zstd is included if meets_python_minimum_version(python_version, "3.14"): @@ -1389,6 +1385,11 @@ def build_cpython( log("copying %s to %s" % (source, dest)) shutil.copyfile(source, dest) + # Delete the tk nmake helper, it's not needed and links msvc + tcltk_commit: str = DOWNLOADS[tk_bin_entry]["git_commit"] + tcltk_path = td / ("cpython-bin-deps-%s" % tcltk_commit) + (tcltk_path / build_directory / "lib" / "nmake" / "x86_64-w64-mingw32-nmakehlp.exe").unlink() + cpython_source_path = td / ("Python-%s" % python_version) pcbuild_path = cpython_source_path / "PCbuild" From e2ed7fae115b0802a98f65bbfa7db32fb4934c5d Mon Sep 17 00:00:00 2001 From: Zanie Blue Date: Thu, 17 Apr 2025 12:54:22 -0500 Subject: [PATCH 14/18] Patch tcltk toggle? --- cpython-windows/build.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/cpython-windows/build.py b/cpython-windows/build.py index 99ea2c0b3..6730025d4 100644 --- a/cpython-windows/build.py +++ b/cpython-windows/build.py @@ -521,6 +521,14 @@ def hack_project_files( zlib_entry, ) + # `--include-tcltk` is forced off on arm64, undo that + # See https://github.com/python/cpython/pull/132650 + static_replace_in_file( + cpython_source_path / "PC" / "layout" / "main.py", + rb'if ns.arch in ("arm32", "arm64"):', + rb'if ns.arch == "arm32":', + ) + # Our SQLite directory is named weirdly. This throws off version detection # in the project file. Replace the parsing logic with a static string. sqlite3_version = DOWNLOADS["sqlite"]["actual_version"].encode("ascii") From 11ec9b36d71fe7df68d2c295ef91084acc00660e Mon Sep 17 00:00:00 2001 From: Zanie Blue Date: Fri, 18 Apr 2025 21:25:30 -0500 Subject: [PATCH 15/18] Allow `api-ms-win-crt-private-l1-1-0.dll` --- src/validation.rs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/validation.rs b/src/validation.rs index 294ed93df..9084754b3 100644 --- a/src/validation.rs +++ b/src/validation.rs @@ -140,8 +140,13 @@ const PE_ALLOWED_LIBRARIES: &[&str] = &[ "tk86t.dll", ]; -// CPython 3.14 and ARM64 use tcl/tk 8.6.14+ which includes a bundled zlib and dynamically links to msvcrt. -const PE_ALLOWED_LIBRARIES_314: &[&str] = &["msvcrt.dll", "zlib1.dll"]; +// CPython 3.14 and ARM64 use a newer version of tcl/tk (8.6.14+) which includes a bundled zlib that +// dynamically links some system libraries +const PE_ALLOWED_LIBRARIES_314: &[&str] = &[ + "zlib1.dll", + "api-ms-win-crt-private-l1-1-0.dll", // zlib loads this library on arm64, 3.14+ + "msvcrt.dll", // zlib loads this library +]; const PE_ALLOWED_LIBRARIES_ARM64: &[&str] = &["msvcrt.dll", "zlib1.dll"]; static GLIBC_MAX_VERSION_BY_TRIPLE: Lazy>> = From dd7e34caa92d1944c9796c376b220d91fea50f7f Mon Sep 17 00:00:00 2001 From: Zanie Blue Date: Fri, 18 Apr 2025 21:26:16 -0500 Subject: [PATCH 16/18] Enable 3.9 and 3.10 again? --- ci-targets.yaml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/ci-targets.yaml b/ci-targets.yaml index c7b4bd12d..20b5be53f 100644 --- a/ci-targets.yaml +++ b/ci-targets.yaml @@ -389,9 +389,8 @@ 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" - # - "3.10" + - "3.9" + - "3.10" - "3.11" - "3.12" - "3.13" From 024f688a5bc273e775f1aaa52a99f06dc6cbafe4 Mon Sep 17 00:00:00 2001 From: Zanie Blue Date: Mon, 21 Apr 2025 09:07:30 -0500 Subject: [PATCH 17/18] Revert "Enable 3.9 and 3.10 again?" This reverts commit a9748a964ea6a85ccaa4e035b863a8e9c179c8f4. --- ci-targets.yaml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/ci-targets.yaml b/ci-targets.yaml index 20b5be53f..c7b4bd12d 100644 --- a/ci-targets.yaml +++ b/ci-targets.yaml @@ -389,8 +389,9 @@ windows: arch: aarch64 vcvars: vcvarsamd64_arm64.bat python_versions: - - "3.9" - - "3.10" + # On 3.9 / 3.10, `_tkinter` is failing to be included in the build + # - "3.9" + # - "3.10" - "3.11" - "3.12" - "3.13" From d49911d62ab73c8786d437870be8c0e789d18828 Mon Sep 17 00:00:00 2001 From: Zanie Blue Date: Mon, 21 Apr 2025 09:10:04 -0500 Subject: [PATCH 18/18] Use consistency exception type --- cpython-windows/build.py | 31 ++++++++++++++++++++++--------- 1 file changed, 22 insertions(+), 9 deletions(-) diff --git a/cpython-windows/build.py b/cpython-windows/build.py index 6730025d4..0df651e11 100644 --- a/cpython-windows/build.py +++ b/cpython-windows/build.py @@ -523,11 +523,14 @@ def hack_project_files( # `--include-tcltk` is forced off on arm64, undo that # See https://github.com/python/cpython/pull/132650 - static_replace_in_file( - cpython_source_path / "PC" / "layout" / "main.py", - rb'if ns.arch in ("arm32", "arm64"):', - rb'if ns.arch == "arm32":', - ) + try: + static_replace_in_file( + cpython_source_path / "PC" / "layout" / "main.py", + rb'if ns.arch in ("arm32", "arm64"):', + rb'if ns.arch == "arm32":', + ) + except NoSearchStringError: + pass # Our SQLite directory is named weirdly. This throws off version detection # in the project file. Replace the parsing logic with a static string. @@ -1116,7 +1119,7 @@ def find_additional_dependencies(project: pathlib.Path): elif arch == "arm64": abi_platform = "win_arm64" else: - raise ValueError("unhandled arch: %s" % arch) + raise Exception("unhandled architecture: %s" % arch) if freethreaded: abi_tag = ".cp%st-%s" % (python_majmin, abi_platform) @@ -1216,7 +1219,7 @@ def find_additional_dependencies(project: pathlib.Path): if name == "zlib": name = zlib_entry -: + # On 3.14+ and aarch64, we use the latest tcl/tk version if ext == "_tkinter" and (python_majmin == "314" or arch == "arm64"): name = name.replace("-8612", "") @@ -1308,7 +1311,11 @@ def build_cpython( # runtime dependencies, so we are conservative and use the old version # elsewhere. The old version isn't built for arm64, so we use the new # version there too - tk_bin_entry = "tk-windows-bin" if meets_python_minimum_version(python_version, "3.14") or arch == "arm64" else "tk-windows-bin-8612" + tk_bin_entry = ( + "tk-windows-bin" + if meets_python_minimum_version(python_version, "3.14") or arch == "arm64" + else "tk-windows-bin-8612" + ) tk_bin_archive = download_entry( tk_bin_entry, BUILD, local_name="tk-windows-bin.tar.gz" ) @@ -1396,7 +1403,13 @@ def build_cpython( # Delete the tk nmake helper, it's not needed and links msvc tcltk_commit: str = DOWNLOADS[tk_bin_entry]["git_commit"] tcltk_path = td / ("cpython-bin-deps-%s" % tcltk_commit) - (tcltk_path / build_directory / "lib" / "nmake" / "x86_64-w64-mingw32-nmakehlp.exe").unlink() + ( + tcltk_path + / build_directory + / "lib" + / "nmake" + / "x86_64-w64-mingw32-nmakehlp.exe" + ).unlink() cpython_source_path = td / ("Python-%s" % python_version) pcbuild_path = cpython_source_path / "PCbuild"