From 6f45403d31b669b74cddda48083324ce8364dbee Mon Sep 17 00:00:00 2001 From: Charlie Marsh Date: Thu, 25 Jul 2024 16:57:38 -0400 Subject: [PATCH] Infer missing `.exe` in Windows Python discovery (#5456) ## Summary Closes https://github.com/astral-sh/uv/issues/5445. --- crates/uv-python/src/discovery.rs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/crates/uv-python/src/discovery.rs b/crates/uv-python/src/discovery.rs index 999e680da..efcd8d718 100644 --- a/crates/uv-python/src/discovery.rs +++ b/crates/uv-python/src/discovery.rs @@ -1096,6 +1096,16 @@ impl PythonRequest { if value_as_path.is_file() { return Self::File(value_as_path); } + + // e.g. path/to/python on Windows, where path/to/python is the true path + #[cfg(windows)] + if value_as_path.extension().is_none() { + let value_as_path = value_as_path.with_extension(EXE_SUFFIX); + if value_as_path.is_file() { + return Self::File(value_as_path); + } + } + // During unit testing, we cannot change the working directory used by std // so we perform a check relative to the mock working directory. Ideally we'd // remove this code and use tests at the CLI level so we can change the real