Skip to content

Commit

Permalink
Create a pythonw.exe copy for free-threaded Windows builds (#408)
Browse files Browse the repository at this point in the history
  • Loading branch information
zanieb authored Dec 6, 2024
1 parent 16b70b8 commit 0ed9d38
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion cpython-windows/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -1221,8 +1221,10 @@ def build_cpython(
if freethreaded:
(major, minor, _) = python_version.split(".")
python_exe = f"python{major}.{minor}t.exe"
pythonw_exe = f"pythonw{major}.{minor}t.exe"
else:
python_exe = "python.exe"
pythonw_exe = "pythonw.exe"

if arch == "amd64":
build_platform = "x64"
Expand Down Expand Up @@ -1529,7 +1531,7 @@ def build_cpython(
log("copying %s to %s" % (source, dest))
shutil.copyfile(source, dest)

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

# Create a `pythonw.exe` copy when an alternative executable is built, e.g., when
# free-threading is enabled the name is `pythonw3.13t.exe`.
canonical_pythonw_exe = install_dir / "pythonw.exe"
if not canonical_pythonw_exe.exists():
shutil.copy2(
install_dir / pythonw_exe,
canonical_pythonw_exe,
)

# CPython 3.13 removed `run_tests.py`, we provide a compatibility script
# for now.
if meets_python_minimum_version(python_version, "3.13"):
Expand Down

0 comments on commit 0ed9d38

Please sign in to comment.