Remove PythonPreference toggle based on UV_TEST_PYTHON_PATH (#7989)

Needed for https://github.com/astral-sh/uv/pull/7934

This is some legacy logic, I think.
This commit is contained in:
Zanie Blue 2024-10-07 16:13:19 -05:00 committed by GitHub
parent 38beb2b24f
commit 46ff220508
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 61 additions and 63 deletions

View file

@ -328,7 +328,7 @@ fn python_executables_from_installed<'a>(
})
.flatten();
let from_windows = std::iter::once_with(move || {
let from_windows_registry = std::iter::once_with(move || {
#[cfg(windows)]
{
// Skip interpreter probing if we already know the version doesn't match.
@ -376,14 +376,14 @@ fn python_executables_from_installed<'a>(
PythonPreference::Managed => Box::new(
from_managed_installations
.chain(from_search_path)
.chain(from_windows),
.chain(from_windows_registry),
),
PythonPreference::System => Box::new(
from_search_path
.chain(from_windows)
.chain(from_windows_registry)
.chain(from_managed_installations),
),
PythonPreference::OnlySystem => Box::new(from_search_path.chain(from_windows)),
PythonPreference::OnlySystem => Box::new(from_search_path.chain(from_windows_registry)),
}
}
@ -1522,15 +1522,6 @@ impl PythonPreference {
}
}
/// Return the default [`PythonPreference`], respecting the `UV_TEST_PYTHON_PATH` variable.
pub fn default_from_env() -> Self {
if env::var_os("UV_TEST_PYTHON_PATH").is_some() {
Self::OnlySystem
} else {
Self::default()
}
}
pub(crate) fn allows_managed(self) -> bool {
matches!(self, Self::Managed | Self::OnlyManaged)
}