mirror of
https://github.com/astral-sh/uv.git
synced 2025-10-30 11:37:24 +00:00
Avoid Windows Store shims in --python python3-like invocations (#2212)
## Summary We have logic in `python_query.rs` to filter out Windows Store shims when you use invocations like `-p 3.10`, but not `--python python3`, which is uncommon but allowed on Windows. Closes #2211.
This commit is contained in:
parent
cf94df7cb9
commit
01ebaef4e7
2 changed files with 37 additions and 21 deletions
|
|
@ -1,4 +1,3 @@
|
|||
use std::ffi::{OsStr, OsString};
|
||||
use std::io::Write;
|
||||
use std::path::{Path, PathBuf};
|
||||
use std::process::Command;
|
||||
|
|
@ -200,25 +199,6 @@ impl Interpreter {
|
|||
}
|
||||
}
|
||||
|
||||
/// Find the Python interpreter in `PATH`, respecting `UV_PYTHON_PATH`.
|
||||
///
|
||||
/// Returns `Ok(None)` if not found.
|
||||
pub(crate) fn find_executable<R: AsRef<OsStr> + Into<OsString> + Copy>(
|
||||
requested: R,
|
||||
) -> Result<Option<PathBuf>, Error> {
|
||||
let result = if let Some(isolated) = std::env::var_os("UV_TEST_PYTHON_PATH") {
|
||||
which::which_in(requested, Some(isolated), std::env::current_dir()?)
|
||||
} else {
|
||||
which::which(requested)
|
||||
};
|
||||
|
||||
match result {
|
||||
Err(which::Error::CannotFindBinaryPath) => Ok(None),
|
||||
Err(err) => Err(Error::WhichError(requested.into(), err)),
|
||||
Ok(path) => Ok(Some(path)),
|
||||
}
|
||||
}
|
||||
|
||||
/// Returns the path to the Python virtual environment.
|
||||
#[inline]
|
||||
pub fn platform(&self) -> &Platform {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue