Skip to content

Commit 0ed9d38

Browse files
authored
Create a pythonw.exe copy for free-threaded Windows builds (#408)
1 parent 16b70b8 commit 0ed9d38

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

cpython-windows/build.py

+12-1
Original file line numberDiff line numberDiff line change
@@ -1221,8 +1221,10 @@ def build_cpython(
12211221
if freethreaded:
12221222
(major, minor, _) = python_version.split(".")
12231223
python_exe = f"python{major}.{minor}t.exe"
1224+
pythonw_exe = f"pythonw{major}.{minor}t.exe"
12241225
else:
12251226
python_exe = "python.exe"
1227+
pythonw_exe = "pythonw.exe"
12261228

12271229
if arch == "amd64":
12281230
build_platform = "x64"
@@ -1529,7 +1531,7 @@ def build_cpython(
15291531
log("copying %s to %s" % (source, dest))
15301532
shutil.copyfile(source, dest)
15311533

1532-
# Rename to `python.exe` when an alternative executable is built, e.g., when
1534+
# Create a `python.exe` copy when an alternative executable is built, e.g., when
15331535
# free-threading is enabled the name is `python3.13t.exe`.
15341536
canonical_python_exe = install_dir / "python.exe"
15351537
if not canonical_python_exe.exists():
@@ -1538,6 +1540,15 @@ def build_cpython(
15381540
canonical_python_exe,
15391541
)
15401542

1543+
# Create a `pythonw.exe` copy when an alternative executable is built, e.g., when
1544+
# free-threading is enabled the name is `pythonw3.13t.exe`.
1545+
canonical_pythonw_exe = install_dir / "pythonw.exe"
1546+
if not canonical_pythonw_exe.exists():
1547+
shutil.copy2(
1548+
install_dir / pythonw_exe,
1549+
canonical_pythonw_exe,
1550+
)
1551+
15411552
# CPython 3.13 removed `run_tests.py`, we provide a compatibility script
15421553
# for now.
15431554
if meets_python_minimum_version(python_version, "3.13"):

0 commit comments

Comments
 (0)