@@ -96,7 +96,8 @@ def install_linux(
9696 # See https://gregoryszorc.com/docs/python-build-standalone/main/running.html#obtaining-distributions
9797 if not re .match (r"^x86_64(|_v2|_v3|_v4)-unknown-linux-(gnu|musl)$" , conf ["target_triple" ]):
9898 raise RuntimeError (f"Unexpected target_triple `{ conf ['target_triple' ]} `" )
99- major , minor = conf ["python_major_minor_version" ].split ("." )
99+ major , minor = map (int , conf ["python_major_minor_version" ].split ("." ))
100+ assert major == 3
100101
101102 shutil .copytree (prebuild_dir / "python/install" , build_dir , symlinks = True )
102103 shutil .copytree (prebuild_dir / "python/licenses" , build_dir / "licenses" , symlinks = True )
@@ -132,6 +133,9 @@ def install_linux(
132133
133134 # Zip the stdlib to save plenty of space \o/
134135 if compressed_stdlib :
136+ # TODO: support Zstandard with Python >= 3.15
137+ archive_format = "zip"
138+
135139 tmp_stdlib_path = build_dir / f"lib/tmp_python{ major } .{ minor } "
136140 shutil .move (stdlib_path , tmp_stdlib_path )
137141
@@ -142,7 +146,7 @@ def install_linux(
142146 shutil .move (tmp_stdlib_path / "lib-dynload" , stdlib_path / "lib-dynload" )
143147 shutil .make_archive (
144148 base_name = str (build_dir / f"lib/python{ major } { minor } " ),
145- format = "zip" , # TODO: use zstd in Python 3.14+
149+ format = archive_format ,
146150 root_dir = tmp_stdlib_path ,
147151 )
148152 shutil .rmtree (tmp_stdlib_path )
@@ -166,7 +170,8 @@ def install_macos(
166170
167171 if conf ["target_triple" ] not in ("x86_64-apple-darwin" ,):
168172 raise RuntimeError (f"Unexpected target_triple `{ conf ['target_triple' ]} `" )
169- major , minor = conf ["python_major_minor_version" ].split ("." )
173+ major , minor = map (int , conf ["python_major_minor_version" ].split ("." ))
174+ assert major == 3
170175
171176 shutil .copytree (prebuild_dir / "python/install" , build_dir , symlinks = True )
172177 shutil .copytree (prebuild_dir / "python/licenses" , build_dir / "licenses" , symlinks = True )
@@ -202,6 +207,9 @@ def install_macos(
202207
203208 # Zip the stdlib to save plenty of space \o/
204209 if compressed_stdlib :
210+ # TODO: support Zstandard with Python >= 3.15
211+ archive_format = "zip"
212+
205213 tmp_stdlib_path = build_dir / f"lib/tmp_python{ major } .{ minor } "
206214 shutil .move (stdlib_path , tmp_stdlib_path )
207215
@@ -212,7 +220,7 @@ def install_macos(
212220 shutil .move (tmp_stdlib_path / "lib-dynload" , stdlib_path / "lib-dynload" )
213221 shutil .make_archive (
214222 base_name = str (build_dir / f"lib/python{ major } { minor } " ),
215- format = "zip" , # TODO: use zstd in Python 3.14+
223+ format = archive_format ,
216224 root_dir = tmp_stdlib_path ,
217225 )
218226 shutil .rmtree (tmp_stdlib_path )
@@ -236,7 +244,8 @@ def install_windows(
236244
237245 if conf ["target_triple" ] not in ("x86_64-pc-windows-msvc" , "i686-pc-windows-msvc" ):
238246 raise RuntimeError (f"Unexpected target_triple `{ conf ['target_triple' ]} `" )
239- major , minor = conf ["python_major_minor_version" ].split ("." )
247+ major , minor = map (int , conf ["python_major_minor_version" ].split ("." ))
248+ assert major == 3
240249
241250 shutil .copytree (prebuild_dir / "python/install" , build_dir , symlinks = True )
242251 shutil .copytree (prebuild_dir / "python/licenses" , build_dir / "licenses" , symlinks = True )
@@ -266,17 +275,19 @@ def install_windows(
266275
267276 # Zip the stdlib to save plenty of space \o/
268277 if compressed_stdlib :
269- tmp_stdlib_path = build_dir / f"lib/tmp_python{ major } .{ minor } "
278+ # TODO: support Zstandard with Python >= 3.15
279+ archive_format = "zip"
280+
281+ tmp_stdlib_path = build_dir / "tmp_Lib"
270282 shutil .move (stdlib_path , tmp_stdlib_path )
271283
272284 # `site-packages` is not stdlib, so it must be excluded from the archive
273285 stdlib_path .mkdir ()
274286 shutil .move (tmp_stdlib_path / site_packages_path .name , site_packages_path )
275287
276- shutil .move (tmp_stdlib_path / "lib-dynload" , stdlib_path / "lib-dynload" )
277288 shutil .make_archive (
278289 base_name = str (build_dir / f"python{ major } { minor } " ),
279- format = "zip" , # TODO: use zstd in Python 3.14+
290+ format = archive_format ,
280291 root_dir = tmp_stdlib_path ,
281292 )
282293 shutil .rmtree (tmp_stdlib_path )
0 commit comments