Add flat index urls to registry wheel index (#928)

Previously, we were missing flat index wheels in the cache.
This commit is contained in:
konsti 2024-01-15 11:21:59 +01:00 committed by GitHub
parent 95f3cca28d
commit 8860a9c29e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -4,7 +4,9 @@ use std::path::Path;
use rustc_hash::FxHashMap;
use distribution_types::{CachedRegistryDist, CachedWheel, IndexLocations};
use distribution_types::{
CachedRegistryDist, CachedWheel, FlatIndexLocation, IndexLocations, IndexUrl,
};
use pep440_rs::Version;
use platform_tags::Tags;
use puffin_cache::{Cache, CacheBucket, WheelCache};
@ -75,7 +77,16 @@ impl<'a> RegistryWheelIndex<'a> {
) -> BTreeMap<Version, CachedRegistryDist> {
let mut versions = BTreeMap::new();
for index_url in index_locations.indexes() {
// Collect into owned `IndexUrl`
let flat_index_urls: Vec<IndexUrl> = index_locations
.flat_indexes()
.filter_map(|flat_index| match flat_index {
FlatIndexLocation::Path(_) => None,
FlatIndexLocation::Url(url) => Some(IndexUrl::Url(url.clone())),
})
.collect();
for index_url in index_locations.indexes().chain(flat_index_urls.iter()) {
// Index all the wheels that were downloaded directly from the registry.
let wheel_dir = cache.shard(
CacheBucket::Wheels,