From 8860a9c29ee153da4874c7ab79ce4e94ab754904 Mon Sep 17 00:00:00 2001 From: konsti Date: Mon, 15 Jan 2024 11:21:59 +0100 Subject: [PATCH] Add flat index urls to registry wheel index (#928) Previously, we were missing flat index wheels in the cache. --- .../src/index/registry_wheel_index.rs | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/crates/puffin-distribution/src/index/registry_wheel_index.rs b/crates/puffin-distribution/src/index/registry_wheel_index.rs index 93068ee55..154002acf 100644 --- a/crates/puffin-distribution/src/index/registry_wheel_index.rs +++ b/crates/puffin-distribution/src/index/registry_wheel_index.rs @@ -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 { let mut versions = BTreeMap::new(); - for index_url in index_locations.indexes() { + // Collect into owned `IndexUrl` + let flat_index_urls: Vec = 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,