From 680188801ff76806daaee085100e1482c7f5eb96 Mon Sep 17 00:00:00 2001 From: Zanie Blue Date: Thu, 5 Dec 2024 22:17:59 -0600 Subject: [PATCH] Create a `pythonw.exe` copy for free-threaded Windows builds --- cpython-windows/build.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/cpython-windows/build.py b/cpython-windows/build.py index 9a5bd856..83eabc7f 100644 --- a/cpython-windows/build.py +++ b/cpython-windows/build.py @@ -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" @@ -1538,6 +1540,15 @@ def build_cpython( canonical_python_exe, ) + # Create `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"):