Skip to content

Commit 8802044

Browse files
committed
Remove shared- prefix from Windows profiles
1 parent 3c5681d commit 8802044

File tree

4 files changed

+37
-19
lines changed

4 files changed

+37
-19
lines changed

.github/workflows/windows.yml

+4
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,12 @@ jobs:
5151
vcvars:
5252
- 'vcvars32.bat'
5353
- 'vcvars64.bat'
54+
# The 'shared-' prefix is no longer needed (i.e., both 'shared-pgo' and 'pgo' resolve to the
55+
# same profile). However, we're double-publishing under both names during the transition
56+
# period.
5457
profile:
5558
- 'shared-pgo'
59+
- 'pgo'
5660
needs: pythonbuild
5761
runs-on: 'windows-2019'
5862
steps:

cpython-windows/build.py

+11-15
Original file line numberDiff line numberDiff line change
@@ -605,7 +605,6 @@ def hack_project_files(
605605
pass
606606

607607

608-
609608
PYPORT_EXPORT_SEARCH_39 = b"""
610609
#if defined(__CYGWIN__)
611610
# define HAVE_DECLSPEC_DLL
@@ -894,12 +893,11 @@ def build_openssl_for_arch(
894893
# uplink.c tries to find the OPENSSL_Applink function exported from the current
895894
# executable. However, it is exported from _ssl[_d].pyd in shared builds. So
896895
# 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+
)
903901

904902
if arch == "x86":
905903
configure = "VC-WIN32"
@@ -1189,7 +1187,6 @@ def collect_python_build_artifacts(
11891187

11901188
extension_projects.add(extension)
11911189

1192-
11931190
depends_projects |= {
11941191
"liblzma",
11951192
"sqlite3",
@@ -1313,9 +1310,7 @@ def find_additional_dependencies(project: pathlib.Path):
13131310
for obj in process_project(ext, dest_dir):
13141311
entry["objs"].append("build/extensions/%s/%s" % (ext, obj))
13151312

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", []):
13191314
entry["links"].append(
13201315
{"name": lib, "path_dynamic": "install/DLLs/%s.dll" % lib}
13211316
)
@@ -1390,7 +1385,7 @@ def build_cpython(
13901385
libffi_archive,
13911386
openssl_entry: str,
13921387
):
1393-
pgo = "-pgo" in profile
1388+
pgo = profile in ("pgo", "shared-pgo")
13941389

13951390
msbuild = find_msbuild(msvc_version)
13961391
log("found MSBuild at %s" % msbuild)
@@ -1724,7 +1719,7 @@ def build_cpython(
17241719

17251720
crt_features = ["vcruntime:140"]
17261721

1727-
if "pgo" in profile:
1722+
if profile in ("pgo", "shared-pgo"):
17281723
optimizations = "pgo"
17291724
else:
17301725
optimizations = "noopt"
@@ -1841,8 +1836,9 @@ def main():
18411836
)
18421837
parser.add_argument(
18431838
"--profile",
1844-
choices={"shared-noopt", "shared-pgo"},
1845-
default="shared-noopt",
1839+
# 'shared-pgo' is an alias for 'pgo'; 'shared-noopt' is an alias for 'noopt'.
1840+
choices={"noopt", "pgo", "shared-noopt", "shared-pgo"},
1841+
default="noopt",
18461842
help="How to compile Python",
18471843
)
18481844
parser.add_argument(

docs/building.rst

+3-3
Original file line numberDiff line numberDiff line change
@@ -94,16 +94,16 @@ If building CPython 3.8+, there are the following additional requirements:
9494

9595
To build a dynamically linked Python distribution for Windows x64::
9696

97-
$ py.exe build-windows.py --profile shared-noopt
97+
$ py.exe build-windows.py --profile noopt
9898

9999
It's also possible to build with optional PGO optimizations::
100100

101-
$ py.exe build-windows.py --profile shared-pgo
101+
$ py.exe build-windows.py --profile pgo
102102

103103
If building CPython 3.8+, you will need to specify the path to a
104104
``sh.exe`` installed from cygwin. e.g.
105105

106-
$ py.exe build-windows.py --python cpython-3.8 --sh c:\cygwin\bin\sh.exe --profile shared
106+
$ py.exe build-windows.py --python cpython-3.8 --sh c:\cygwin\bin\sh.exe --profile noopt
107107

108108
To build a 32-bit x86 binary, simply use an ``x86 Native Tools
109109
Command Prompt`` instead of ``x64``.

src/release.rs

+19-1
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,26 @@ pub static RELEASE_TRIPLES: Lazy<BTreeMap<&'static str, TripleRelease>> = Lazy::
4747
);
4848

4949
// Windows.
50+
h.insert(
51+
"i686-pc-windows-msvc",
52+
TripleRelease {
53+
suffixes: vec!["pgo"],
54+
install_only_suffix: "pgo",
55+
python_version_requirement: None,
56+
},
57+
);
58+
h.insert(
59+
"x86_64-pc-windows-msvc",
60+
TripleRelease {
61+
suffixes: vec!["pgo"],
62+
install_only_suffix: "pgo",
63+
python_version_requirement: None,
64+
},
65+
);
5066

51-
// The -shared part of the triple is a lie. But the code handles it fine.
67+
// The 'shared-' prefix is no longer needed (i.e., both 'shared-pgo' and 'pgo' resolve to the
68+
// same profile). However, we're double-publishing under both names during the transition
69+
// period.
5270
h.insert(
5371
"i686-pc-windows-msvc-shared",
5472
TripleRelease {

0 commit comments

Comments
 (0)