mirror of
https://github.com/astral-sh/uv.git
synced 2025-07-24 13:43:45 +00:00
Require opt-in to use alternative Python implementations (#7650)
Closes #7118 This only really affects managed interpreters, as we exclude alternative Python implementations from the search path during the `VersionRequest::executable_names` part of discovery.
This commit is contained in:
parent
da328379c1
commit
a53ddaa24a
6 changed files with 100 additions and 14 deletions
|
@ -16,7 +16,8 @@ use crate::implementation::LenientImplementationName;
|
|||
use crate::managed::{ManagedPythonInstallation, ManagedPythonInstallations};
|
||||
use crate::platform::{Arch, Libc, Os};
|
||||
use crate::{
|
||||
downloads, Error, Interpreter, PythonDownloads, PythonPreference, PythonSource, PythonVersion,
|
||||
downloads, Error, ImplementationName, Interpreter, PythonDownloads, PythonPreference,
|
||||
PythonSource, PythonVersion,
|
||||
};
|
||||
|
||||
/// A Python interpreter and accompanying tools.
|
||||
|
@ -176,6 +177,16 @@ impl PythonInstallation {
|
|||
LenientImplementationName::from(self.interpreter.implementation_name())
|
||||
}
|
||||
|
||||
/// Whether this is a CPython installation.
|
||||
///
|
||||
/// Returns false if it is an alternative implementation, e.g., PyPy.
|
||||
pub(crate) fn is_alternative_implementation(&self) -> bool {
|
||||
!matches!(
|
||||
self.implementation(),
|
||||
LenientImplementationName::Known(ImplementationName::CPython)
|
||||
)
|
||||
}
|
||||
|
||||
/// Return the [`Arch`] of the Python installation as reported by its interpreter.
|
||||
pub fn arch(&self) -> Arch {
|
||||
self.interpreter.arch()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue