@@ -311,30 +311,6 @@ def static_replace_in_file(p: pathlib.Path, search, replace):
311311 fh .write (data )
312312
313313
314- def apply_source_patch (cpython_source_path : pathlib .Path , patch_path : pathlib .Path ):
315- with patch_path .open ("rb" ) as fh :
316- patch = fh .read ().replace (b"\r \n " , b"\n " )
317-
318- with tempfile .NamedTemporaryFile ("wb" , delete = False ) as fh :
319- fh .write (patch )
320- normalized_patch = pathlib .Path (fh .name )
321-
322- try :
323- subprocess .run (
324- [
325- "git.exe" ,
326- "-C" ,
327- str (cpython_source_path ),
328- "apply" ,
329- "--whitespace=nowarn" ,
330- str (normalized_patch ),
331- ],
332- check = True ,
333- )
334- finally :
335- normalized_patch .unlink ()
336-
337-
338314OPENSSL_PROPS_REMOVE_RULES_LEGACY = b"""
339315 <ItemGroup>
340316 <_SSLDLL Include="$(opensslOutDir)\libcrypto$(_DLLSuffix).dll" />
@@ -396,8 +372,10 @@ def hack_props(
396372
397373 mpdecimal_version = DOWNLOADS ["mpdecimal" ]["version" ]
398374
399- if meets_python_minimum_version (python_version , "3.14" ) or arch == "arm64" :
400- tcltk_commit = DOWNLOADS ["tk-windows-bin" ]["git_commit" ]
375+ if meets_python_minimum_version (python_version , "3.15" ):
376+ tcltk_commit = DOWNLOADS ["tk-windows-bin-903" ]["git_commit" ]
377+ elif meets_python_minimum_version (python_version , "3.14" ) or arch == "arm64" :
378+ tcltk_commit = DOWNLOADS ["tk-windows-bin-8614" ]["git_commit" ]
401379 else :
402380 tcltk_commit = DOWNLOADS ["tk-windows-bin-8612" ]["git_commit" ]
403381
@@ -1395,15 +1373,17 @@ def build_cpython(
13951373 setuptools_wheel = download_entry ("setuptools" , BUILD )
13961374 pip_wheel = download_entry ("pip" , BUILD )
13971375
1398- # On CPython 3.14+, we use the latest tcl/tk version which has additional
1399- # runtime dependencies, so we are conservative and use the old version
1400- # elsewhere. The old version isn't built for arm64, so we use the new
1401- # version there too
1402- tk_bin_entry = (
1403- "tk-windows-bin"
1404- if meets_python_minimum_version (python_version , "3.14" ) or arch == "arm64"
1405- else "tk-windows-bin-8612"
1406- )
1376+ # We use a prebuild tcl/tk from the upstream CPython project.
1377+ # Tcl/tk 8.6.14+ has an additional runtime dependency. We are conservative and
1378+ # use an old version prior to CPython 3.14. The older tck/tk release
1379+ # is not available for arm64 so we use a newer release there as well.
1380+ # On CPython 3.14+ we match the version included in the Python.org release.
1381+ if meets_python_minimum_version (python_version , "3.15" ):
1382+ tk_bin_entry = "tk-windows-bin-903"
1383+ elif meets_python_minimum_version (python_version , "3.14" ) or arch == "arm64" :
1384+ tk_bin_entry = "tk-windows-bin-8614"
1385+ else :
1386+ tk_bin_entry = "tk-windows-bin-8612"
14071387 tk_bin_archive = download_entry (
14081388 tk_bin_entry , BUILD , local_name = "tk-windows-bin.tar.gz"
14091389 )
@@ -1509,7 +1489,7 @@ def build_cpython(
15091489 shutil .copyfile (source , dest )
15101490
15111491 # Delete the tk nmake helper, it's not needed and links msvc
1512- if tk_bin_entry == "tk-windows-bin" :
1492+ if tk_bin_entry in ( "tk-windows-bin-8614" , "tk-windows-bin-903" ) :
15131493 tcltk_commit : str = DOWNLOADS [tk_bin_entry ]["git_commit" ]
15141494 tcltk_path = td / ("cpython-bin-deps-%s" % tcltk_commit )
15151495 (
@@ -1523,12 +1503,6 @@ def build_cpython(
15231503 cpython_source_path = td / ("Python-%s" % python_version )
15241504 pcbuild_path = cpython_source_path / "PCbuild"
15251505
1526- if python_version .startswith ("3.15." ):
1527- apply_source_patch (
1528- cpython_source_path ,
1529- SUPPORT / "patch-site-reentrant-startup-files-3.15.patch" ,
1530- )
1531-
15321506 out_dir = td / "out"
15331507
15341508 build_dir = out_dir / "python" / "build"
0 commit comments