From ee331bfdf52c5b49be8d48a27df6d5a43ddbb447 Mon Sep 17 00:00:00 2001 From: Charlie Marsh Date: Sun, 20 Jul 2025 18:17:51 -0400 Subject: [PATCH] Add Windows --- crates/uv-virtualenv/src/virtualenv.rs | 40 +++++++++++++++++++++++++- 1 file changed, 39 insertions(+), 1 deletion(-) diff --git a/crates/uv-virtualenv/src/virtualenv.rs b/crates/uv-virtualenv/src/virtualenv.rs index 7d2dad943..869982f70 100644 --- a/crates/uv-virtualenv/src/virtualenv.rs +++ b/crates/uv-virtualenv/src/virtualenv.rs @@ -373,6 +373,24 @@ pub(crate) fn create( &scripts, python_home, )?; + + // If the GIL is disabled, copy `venvlaunchert.exe` and `venvwlaunchert.exe`. + if interpreter.gil_disabled() { + copy_launcher_windows( + WindowsExecutable::PythonMajorMinort, + interpreter, + &base_python, + &scripts, + python_home, + )?; + copy_launcher_windows( + WindowsExecutable::PythonwMajorMinort, + interpreter, + &base_python, + &scripts, + python_home, + )?; + } } } } @@ -590,8 +608,12 @@ enum WindowsExecutable { PythonMajor, /// The `python3..exe` executable (or `venvlauncher.exe` launcher shim). PythonMajorMinor, + /// The `python3.t.exe` executable (or `venvlaunchert.exe` launcher shim). + PythonMajorMinort, /// The `pythonw.exe` executable (or `venvwlauncher.exe` launcher shim). Pythonw, + /// The `pythonw3.t.exe` executable (or `venvwlaunchert.exe` launcher shim). + PythonwMajorMinort, /// The `pypy.exe` executable. PyPy, /// The `pypy3.exe` executable. @@ -602,7 +624,7 @@ enum WindowsExecutable { PyPyw, /// The `pypy3.w.exe` executable. PyPyMajorMinorw, - // The `graalpy.exe` executable + /// The `graalpy.exe` executable. GraalPy, } @@ -621,7 +643,21 @@ impl WindowsExecutable { interpreter.python_minor() ) } + WindowsExecutable::PythonMajorMinort => { + format!( + "python{}.{}t.exe", + interpreter.python_major(), + interpreter.python_minor() + ) + } WindowsExecutable::Pythonw => String::from("pythonw.exe"), + WindowsExecutable::PythonwMajorMinort => { + format!( + "pythonw{}.{}t.exe", + interpreter.python_major(), + interpreter.python_minor() + ) + } WindowsExecutable::PyPy => String::from("pypy.exe"), WindowsExecutable::PyPyMajor => { format!("pypy{}.exe", interpreter.python_major()) @@ -656,6 +692,8 @@ impl WindowsExecutable { Self::Python | Self::PythonMajor | Self::PythonMajorMinor => "venvlauncher.exe", Self::Pythonw if interpreter.gil_disabled() => "venvwlaunchert.exe", Self::Pythonw => "venvwlauncher.exe", + Self::PythonMajorMinort => "venvlaunchert.exe", + Self::PythonwMajorMinort => "venvwlaunchert.exe", // From 3.13 on these should replace the `python.exe` and `pythonw.exe` shims. // These are not relevant as of now for PyPy as it doesn't yet support Python 3.13. Self::PyPy | Self::PyPyMajor | Self::PyPyMajorMinor => "venvlauncher.exe",