mirror of
https://github.com/astral-sh/uv.git
synced 2025-07-24 13:43:45 +00:00
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:
parent
38beb2b24f
commit
46ff220508
7 changed files with 61 additions and 63 deletions
|
@ -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)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue