mirror of
https://github.com/astral-sh/uv.git
synced 2025-10-20 23:31:54 +00:00
Allow package lookups across multiple indexes via explicit opt-in (#2815)
## Summary This partially revives https://github.com/astral-sh/uv/pull/2135 (with some modifications) to enable users to opt-in to looking for packages across multiple indexes. The behavior is such that, in version selection, we take _any_ compatible version from a "higher-priority" index over the compatible versions of a "lower-priority" index, even if that means we might accept an "older" version. Closes https://github.com/astral-sh/uv/issues/2775.
This commit is contained in:
parent
e0d55ef496
commit
34341bd6e9
23 changed files with 351 additions and 106 deletions
|
@ -174,16 +174,10 @@ impl VersionMap {
|
|||
}
|
||||
|
||||
/// Return the [`Hashes`] for the given version, if any.
|
||||
pub(crate) fn hashes(&self, version: &Version) -> Vec<Hashes> {
|
||||
pub(crate) fn hashes(&self, version: &Version) -> Option<Vec<Hashes>> {
|
||||
match self.inner {
|
||||
VersionMapInner::Eager(ref map) => map
|
||||
.get(version)
|
||||
.map(|file| file.hashes().to_vec())
|
||||
.unwrap_or_default(),
|
||||
VersionMapInner::Lazy(ref lazy) => lazy
|
||||
.get(version)
|
||||
.map(|file| file.hashes().to_vec())
|
||||
.unwrap_or_default(),
|
||||
VersionMapInner::Eager(ref map) => map.get(version).map(|file| file.hashes().to_vec()),
|
||||
VersionMapInner::Lazy(ref lazy) => lazy.get(version).map(|file| file.hashes().to_vec()),
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue