Skip to content

Commit 2711fb9

Browse files
committed
Use the newer tcl-tk bin for arm64 builds
1 parent 068e2b9 commit 2711fb9

File tree

1 file changed

+14
-9
lines changed

1 file changed

+14
-9
lines changed

cpython-windows/build.py

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -359,7 +359,7 @@ def hack_props(
359359

360360
mpdecimal_version = DOWNLOADS["mpdecimal"]["version"]
361361

362-
if meets_python_minimum_version(python_version, "3.14"):
362+
if meets_python_minimum_version(python_version, "3.14") or arch == "arm64":
363363
tcltk_commit = DOWNLOADS["tk-windows-bin"]["git_commit"]
364364
else:
365365
tcltk_commit = DOWNLOADS["tk-windows-bin-8612"]["git_commit"]
@@ -486,6 +486,7 @@ def hack_project_files(
486486
cpython_source_path: pathlib.Path,
487487
build_directory: str,
488488
python_version: str,
489+
arch: str,
489490
):
490491
"""Hacks Visual Studio project files to work with our build."""
491492

@@ -583,9 +584,10 @@ def hack_project_files(
583584
# have a standalone zlib DLL, so we remove references to it. For Python
584585
# 3.14+, we're using tk-windows-bin 8.6.14 which includes a prebuilt zlib
585586
# DLL, so we skip this patch there.
586-
if meets_python_minimum_version(
587-
python_version, "3.12"
588-
) and meets_python_maximum_version(python_version, "3.13"):
587+
# On arm64, we use the new version of tk-windows-bin for all versions.
588+
if meets_python_minimum_version(python_version, "3.12") and (
589+
meets_python_maximum_version(python_version, "3.13") or arch == "arm64"
590+
):
589591
static_replace_in_file(
590592
pcbuild_path / "_tkinter.vcxproj",
591593
rb'<_TclTkDLL Include="$(tcltkdir)\bin\$(tclZlibDllName)" />',
@@ -1175,8 +1177,8 @@ def find_additional_dependencies(project: pathlib.Path):
11751177
if name == "openssl":
11761178
name = openssl_entry
11771179

1178-
# On 3.14+, we use the latest tcl/tk version
1179-
if ext == "_tkinter" and python_majmin == "314":
1180+
# On 3.14+ and aarch64, we use the latest tcl/tk version
1181+
if ext == "_tkinter" and (python_majmin == "314" or arch == "arm64"):
11801182
name = name.replace("-8612", "")
11811183

11821184
download_entry = DOWNLOADS[name]
@@ -1259,9 +1261,11 @@ def build_cpython(
12591261
setuptools_wheel = download_entry("setuptools", BUILD)
12601262
pip_wheel = download_entry("pip", BUILD)
12611263

1262-
# On CPython 3.14+, we use the latest tcl/tk version which has additional runtime
1263-
# dependencies, so we are conservative and use the old version elsewhere.
1264-
if meets_python_minimum_version(python_version, "3.14"):
1264+
# On CPython 3.14+, we use the latest tcl/tk version which has additional
1265+
# runtime dependencies, so we are conservative and use the old version
1266+
# elsewhere. The old version isn't built for arm64, so we use the new
1267+
# version there too
1268+
if meets_python_minimum_version(python_version, "3.14") or arch == "arm64":
12651269
tk_bin_archive = download_entry(
12661270
"tk-windows-bin", BUILD, local_name="tk-windows-bin.tar.gz"
12671271
)
@@ -1364,6 +1368,7 @@ def build_cpython(
13641368
cpython_source_path,
13651369
build_directory,
13661370
python_version=python_version,
1371+
arch=arch,
13671372
)
13681373

13691374
if pgo:

0 commit comments

Comments
 (0)