Skip over broken tool Python on Windows too (#17176)

Fixes #16252
This commit is contained in:
konsti
2026-03-05 10:02:49 +01:00
committed by GitHub
parent 02e92aed3b
commit 8efb5421bc
9 changed files with 177 additions and 38 deletions
+7
View File
@@ -34,6 +34,8 @@ pub struct VirtualEnvironment {
/// A parsed `pyvenv.cfg`
#[derive(Debug, Clone)]
pub struct PyVenvConfiguration {
/// The `PYTHONHOME` directory containing the base Python executable.
pub(crate) home: Option<PathBuf>,
/// Was the virtual environment created with the `virtualenv` package?
pub(crate) virtualenv: bool,
/// Was the virtual environment created with the `uv` package?
@@ -231,6 +233,7 @@ pub(crate) fn virtualenv_python_executable(venv: impl AsRef<Path>) -> PathBuf {
impl PyVenvConfiguration {
/// Parse a `pyvenv.cfg` file into a [`PyVenvConfiguration`].
pub fn parse(cfg: impl AsRef<Path>) -> Result<Self, Error> {
let mut home = None;
let mut virtualenv = false;
let mut uv = false;
let mut relocatable = false;
@@ -248,6 +251,9 @@ impl PyVenvConfiguration {
continue;
};
match key.trim() {
"home" => {
home = Some(PathBuf::from(value.trim()));
}
"virtualenv" => {
virtualenv = true;
}
@@ -274,6 +280,7 @@ impl PyVenvConfiguration {
}
Ok(Self {
home,
virtualenv,
uv,
relocatable,