Differentiate between implicit vs explicit architecture requests (#13723)

In https://github.com/astral-sh/uv/pull/13721#issuecomment-2920530601 I
presumed that all the installation problems in
https://github.com/astral-sh/uv/pull/13722 were solved by
https://github.com/astral-sh/uv/pull/13709 but they were not because we
don't differentiate between implicit and explicit architecture requests
so a request for `aarch64` is considered satisfied by an existing
`x86-64` installation even if the user explicitly requested that
architecture.

Now, we track if it was explicit or implicit, requiring an exact match
in the former case, and a `supports` in the latter.

We considered doing this for other items in the request, like the
operating system but we don't have a `supports()` concept there. It
might make sense for libc in the future.
This commit is contained in:
Zanie Blue
2025-05-29 17:04:57 -05:00
committed by GitHub
parent 067b03cc9a
commit 0c5ae1f25c
4 changed files with 48 additions and 30 deletions
+5 -5
View File
@@ -2723,7 +2723,7 @@ mod tests {
use crate::{
discovery::{PythonRequest, VersionRequest},
downloads::PythonDownloadRequest,
downloads::{ArchRequest, PythonDownloadRequest},
implementation::ImplementationName,
platform::{Arch, Libc, Os},
};
@@ -2813,10 +2813,10 @@ mod tests {
PythonVariant::Default
)),
implementation: Some(ImplementationName::CPython),
arch: Some(Arch {
arch: Some(ArchRequest::Explicit(Arch {
family: Architecture::Aarch64(Aarch64Architecture::Aarch64),
variant: None
}),
})),
os: Some(Os(target_lexicon::OperatingSystem::Darwin(None))),
libc: Some(Libc::None),
prereleases: None
@@ -2848,10 +2848,10 @@ mod tests {
PythonVariant::Default
)),
implementation: None,
arch: Some(Arch {
arch: Some(ArchRequest::Explicit(Arch {
family: Architecture::Aarch64(Aarch64Architecture::Aarch64),
variant: None
}),
})),
os: None,
libc: None,
prereleases: None