@@ -346,6 +346,7 @@ def hack_props(
346346 pcbuild_path : pathlib .Path ,
347347 arch : str ,
348348 python_version : str ,
349+ zlib_entry : str ,
349350):
350351 # TODO can we pass props into msbuild.exe?
351352
@@ -355,7 +356,7 @@ def hack_props(
355356 bzip2_version = DOWNLOADS ["bzip2" ]["version" ]
356357 sqlite_version = DOWNLOADS ["sqlite" ]["version" ]
357358 xz_version = DOWNLOADS ["xz" ]["version" ]
358- zlib_version = DOWNLOADS ["zlib" ]["version" ]
359+ zlib_version = DOWNLOADS [zlib_entry ]["version" ]
359360
360361 mpdecimal_version = DOWNLOADS ["mpdecimal" ]["version" ]
361362
@@ -369,7 +370,8 @@ def hack_props(
369370 libffi_path = td / "libffi"
370371 tcltk_path = td / ("cpython-bin-deps-%s" % tcltk_commit )
371372 xz_path = td / ("xz-%s" % xz_version )
372- zlib_path = td / ("zlib-%s" % zlib_version )
373+ zlib_prefix = "cpython-source-deps-" if zlib_entry == "zlib-ng" else ""
374+ zlib_path = td / ("%s%s-%s" % (zlib_prefix , zlib_entry , zlib_version ))
373375 mpdecimal_path = td / ("mpdecimal-%s" % mpdecimal_version )
374376
375377 openssl_root = td / "openssl" / arch
@@ -410,6 +412,10 @@ def hack_props(
410412 elif b"<zlibDir" in line :
411413 line = b"<zlibDir>%s\\ </zlibDir>" % zlib_path
412414
415+ # On 3.14+, it's zlib-ng and the name changed
416+ elif b"<zlibNgDir" in line :
417+ line = b"<zlibNgDir>%s\\ </zlibNgDir>" % zlib_path
418+
413419 elif b"<mpdecimalDir" in line :
414420 line = b"<mpdecimalDir>%s\\ </mpdecimalDir>" % mpdecimal_path
415421
@@ -484,6 +490,7 @@ def hack_project_files(
484490 cpython_source_path : pathlib .Path ,
485491 build_directory : str ,
486492 python_version : str ,
493+ zlib_entry : str ,
487494):
488495 """Hacks Visual Studio project files to work with our build."""
489496
@@ -494,6 +501,7 @@ def hack_project_files(
494501 pcbuild_path ,
495502 build_directory ,
496503 python_version ,
504+ zlib_entry ,
497505 )
498506
499507 # Our SQLite directory is named weirdly. This throws off version detection
@@ -913,6 +921,7 @@ def collect_python_build_artifacts(
913921 arch : str ,
914922 config : str ,
915923 openssl_entry : str ,
924+ zlib_entry : str ,
916925 freethreaded : bool ,
917926):
918927 """Collect build artifacts from Python.
@@ -993,6 +1002,7 @@ def collect_python_build_artifacts(
9931002 depends_projects |= {
9941003 "liblzma" ,
9951004 "sqlite3" ,
1005+ "zlib-ng" ,
9961006 }
9971007
9981008 known_projects = (
@@ -1142,6 +1152,9 @@ def find_additional_dependencies(project: pathlib.Path):
11421152 if name == "openssl" :
11431153 name = openssl_entry
11441154
1155+ if name == "zlib" :
1156+ name = zlib_entry
1157+
11451158 # On 3.14+, we use the latest tcl/tk version
11461159 if ext == "_tkinter" and python_majmin == "314" :
11471160 name = name .replace ("-8612" , "" )
@@ -1213,16 +1226,19 @@ def build_cpython(
12131226 # The python.props file keys off MSBUILD, so it needs to be set.
12141227 os .environ ["MSBUILD" ] = str (msbuild )
12151228
1216- bzip2_archive = download_entry ("bzip2" , BUILD )
1217- sqlite_archive = download_entry ("sqlite" , BUILD )
1218- xz_archive = download_entry ("xz" , BUILD )
1219- zlib_archive = download_entry ("zlib" , BUILD )
1220-
12211229 python_archive = download_entry (python_entry_name , BUILD )
12221230 entry = DOWNLOADS [python_entry_name ]
1223-
12241231 python_version = entry ["version" ]
12251232
1233+ zlib_entry = (
1234+ "zlib-ng" if meets_python_minimum_version (python_version , "3.14" ) else "zlib"
1235+ )
1236+
1237+ bzip2_archive = download_entry ("bzip2" , BUILD )
1238+ sqlite_archive = download_entry ("sqlite" , BUILD )
1239+ xz_archive = download_entry ("xz" , BUILD )
1240+ zlib_archive = download_entry (zlib_entry , BUILD )
1241+
12261242 setuptools_wheel = download_entry ("setuptools" , BUILD )
12271243 pip_wheel = download_entry ("pip" , BUILD )
12281244
@@ -1328,6 +1344,7 @@ def build_cpython(
13281344 cpython_source_path ,
13291345 build_directory ,
13301346 python_version = python_version ,
1347+ zlib_entry = zlib_entry ,
13311348 )
13321349
13331350 if pgo :
@@ -1528,6 +1545,7 @@ def build_cpython(
15281545 build_directory ,
15291546 artifact_config ,
15301547 openssl_entry = openssl_entry ,
1548+ zlib_entry = zlib_entry ,
15311549 freethreaded = freethreaded ,
15321550 )
15331551
0 commit comments