mirror of
https://github.com/astral-sh/uv.git
synced 2025-08-29 23:14:11 +00:00
Display Python installation key for discovered interpreters (#5365)
> DEBUG Found `cpython-3.12.1-macos-aarch64-none` at `/Users/zb/Library/Application Support/uv/python/cpython-3.12.1-macos-aarch64-none/bin/python3` (managed installations) Instead of `<implementation> <version>` > DEBUG Found cpython 3.12.1 at `/Users/zb/Library/Application Support/uv/python/cpython-3.12.1-macos-aarch64-none/bin/python3` (managed installations)
This commit is contained in:
parent
2cdcc61da9
commit
7908436a76
3 changed files with 39 additions and 18 deletions
|
@ -21,8 +21,10 @@ use pypi_types::Scheme;
|
|||
use uv_cache::{Cache, CacheBucket, CachedByTimestamp, Freshness, Timestamp};
|
||||
use uv_fs::{write_atomic_sync, PythonExt, Simplified};
|
||||
|
||||
use crate::implementation::LenientImplementationName;
|
||||
use crate::platform::{Arch, Libc, Os};
|
||||
use crate::pointer_size::PointerSize;
|
||||
use crate::{Prefix, PythonVersion, Target, VirtualEnvironment};
|
||||
use crate::{Prefix, PythonInstallationKey, PythonVersion, Target, VirtualEnvironment};
|
||||
|
||||
/// A Python executable and its associated platform markers.
|
||||
#[derive(Debug, Clone)]
|
||||
|
@ -172,6 +174,34 @@ impl Interpreter {
|
|||
&self.markers
|
||||
}
|
||||
|
||||
/// Returns the [`PythonInstallationKey`] for this interpreter.
|
||||
pub fn key(&self) -> PythonInstallationKey {
|
||||
PythonInstallationKey::new(
|
||||
LenientImplementationName::from(self.implementation_name()),
|
||||
self.python_major(),
|
||||
self.python_minor(),
|
||||
self.python_patch(),
|
||||
self.os(),
|
||||
self.arch(),
|
||||
self.libc(),
|
||||
)
|
||||
}
|
||||
|
||||
/// Return the [`Arch`] reported by the interpreter platform tags.
|
||||
pub fn arch(&self) -> Arch {
|
||||
Arch::from(&self.platform().arch())
|
||||
}
|
||||
|
||||
/// Return the [`Libc`] reported by the interpreter platform tags.
|
||||
pub fn libc(&self) -> Libc {
|
||||
Libc::from(self.platform().os())
|
||||
}
|
||||
|
||||
/// Return the [`Os`] reported by the interpreter platform tags.
|
||||
pub fn os(&self) -> Os {
|
||||
Os::from(self.platform().os())
|
||||
}
|
||||
|
||||
/// Returns the [`Tags`] for this Python executable.
|
||||
pub fn tags(&self) -> Result<&Tags, TagsError> {
|
||||
self.tags.get_or_try_init(|| {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue