Skip to content

Commit

Permalink
Infer missing .exe in Windows Python discovery (#5456)
Browse files Browse the repository at this point in the history
## Summary

Closes #5445.
  • Loading branch information
charliermarsh committed Jul 25, 2024
1 parent 1e965b4 commit 6f45403
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions crates/uv-python/src/discovery.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 6f45403

Please sign in to comment.