@@ -605,7 +605,6 @@ def hack_project_files(
605
605
pass
606
606
607
607
608
-
609
608
PYPORT_EXPORT_SEARCH_39 = b"""
610
609
#if defined(__CYGWIN__)
611
610
# define HAVE_DECLSPEC_DLL
@@ -894,12 +893,11 @@ def build_openssl_for_arch(
894
893
# uplink.c tries to find the OPENSSL_Applink function exported from the current
895
894
# executable. However, it is exported from _ssl[_d].pyd in shared builds. So
896
895
# update its sounce to look for it from there.
897
- if "shared" in profile :
898
- static_replace_in_file (
899
- source_root / "ms" / "uplink.c" ,
900
- b"((h = GetModuleHandle(NULL)) == NULL)" ,
901
- b'((h = GetModuleHandleA("_ssl.pyd")) == NULL) if ((h = GetModuleHandleA("_ssl_d.pyd")) == NULL) if ((h = GetModuleHandle(NULL)) == NULL)' ,
902
- )
896
+ static_replace_in_file (
897
+ source_root / "ms" / "uplink.c" ,
898
+ b"((h = GetModuleHandle(NULL)) == NULL)" ,
899
+ b'((h = GetModuleHandleA("_ssl.pyd")) == NULL) if ((h = GetModuleHandleA("_ssl_d.pyd")) == NULL) if ((h = GetModuleHandle(NULL)) == NULL)' ,
900
+ )
903
901
904
902
if arch == "x86" :
905
903
configure = "VC-WIN32"
@@ -1189,7 +1187,6 @@ def collect_python_build_artifacts(
1189
1187
1190
1188
extension_projects .add (extension )
1191
1189
1192
-
1193
1190
depends_projects |= {
1194
1191
"liblzma" ,
1195
1192
"sqlite3" ,
@@ -1313,9 +1310,7 @@ def find_additional_dependencies(project: pathlib.Path):
1313
1310
for obj in process_project (ext , dest_dir ):
1314
1311
entry ["objs" ].append ("build/extensions/%s/%s" % (ext , obj ))
1315
1312
1316
- for lib in CONVERT_TO_BUILTIN_EXTENSIONS .get (ext , {}).get (
1317
- "shared_depends" , []
1318
- ):
1313
+ for lib in CONVERT_TO_BUILTIN_EXTENSIONS .get (ext , {}).get ("shared_depends" , []):
1319
1314
entry ["links" ].append (
1320
1315
{"name" : lib , "path_dynamic" : "install/DLLs/%s.dll" % lib }
1321
1316
)
@@ -1389,8 +1384,8 @@ def build_cpython(
1389
1384
openssl_archive ,
1390
1385
libffi_archive ,
1391
1386
openssl_entry : str ,
1392
- ):
1393
- pgo = "- pgo" in profile
1387
+ ) -> pathlib . Path :
1388
+ pgo = profile == " pgo"
1394
1389
1395
1390
msbuild = find_msbuild (msvc_version )
1396
1391
log ("found MSBuild at %s" % msbuild )
@@ -1724,7 +1719,7 @@ def build_cpython(
1724
1719
1725
1720
crt_features = ["vcruntime:140" ]
1726
1721
1727
- if "pgo" in profile :
1722
+ if profile == "pgo" :
1728
1723
optimizations = "pgo"
1729
1724
else :
1730
1725
optimizations = "noopt"
@@ -1817,7 +1812,7 @@ def fetch_strawberry_perl() -> pathlib.Path:
1817
1812
return strawberryperl
1818
1813
1819
1814
1820
- def main ():
1815
+ def main () -> None :
1821
1816
BUILD .mkdir (exist_ok = True )
1822
1817
1823
1818
parser = argparse .ArgumentParser ()
@@ -1841,8 +1836,8 @@ def main():
1841
1836
)
1842
1837
parser .add_argument (
1843
1838
"--profile" ,
1844
- choices = {"shared- noopt" , "shared- pgo" },
1845
- default = "shared- noopt" ,
1839
+ choices = {"noopt" , "pgo" },
1840
+ default = "noopt" ,
1846
1841
help = "How to compile Python" ,
1847
1842
)
1848
1843
parser .add_argument (
@@ -1920,12 +1915,23 @@ def main():
1920
1915
else :
1921
1916
release_tag = release_tag_from_git ()
1922
1917
1923
- compress_python_archive (
1918
+ # Create, e.g., `cpython-3.10.13+20240224-x86_64-pc-windows-msvc-pgo.tar.zst`.
1919
+ dest_path = compress_python_archive (
1924
1920
tar_path ,
1925
1921
DIST ,
1926
1922
"%s-%s" % (tar_path .stem , release_tag ),
1927
1923
)
1928
1924
1925
+ # Copy to, e.g., `cpython-3.10.13+20240224-x86_64-pc-windows-msvc-shared-pgo.tar.zst`.
1926
+ # The 'shared-' prefix is no longer needed, but we're double-publishing under
1927
+ # both names during the transition period.
1928
+ filename : str = dest_path .name
1929
+ if not filename .endswith ("-%s-%s.tar.zst" % (args .profile , release_tag )):
1930
+ raise ValueError ("expected filename to end with profile: %s" % filename )
1931
+ filename = filename .removesuffix ("-%s-%s.tar.zst" % (args .profile , release_tag ))
1932
+ filename = filename + "-shared-%s-%s.tar.zst" % (args .profile , release_tag )
1933
+ shutil .copy2 (dest_path , dest_path .with_name (filename ))
1934
+
1929
1935
1930
1936
if __name__ == "__main__" :
1931
1937
sys .exit (main ())
0 commit comments