From 8cbe1d220c276eb1f5297b45df0691ce56683c95 Mon Sep 17 00:00:00 2001 From: Charlie Marsh Date: Wed, 31 Jan 2024 20:41:29 -0800 Subject: [PATCH] Remove double-download for source distributions (#1218) ## Summary Oops -- this was using a different cache key than the route above (this is the wheel _metadata_ route vs. the wheel build route), so we were saving and building source distributions twice in `pip install`. --- crates/puffin-distribution/src/source/mod.rs | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/crates/puffin-distribution/src/source/mod.rs b/crates/puffin-distribution/src/source/mod.rs index f7a661bfa..d1ad59103 100644 --- a/crates/puffin-distribution/src/source/mod.rs +++ b/crates/puffin-distribution/src/source/mod.rs @@ -15,8 +15,8 @@ use zip::ZipArchive; use distribution_filename::WheelFilename; use distribution_types::{ - DirectArchiveUrl, DirectGitUrl, Dist, FileLocation, GitSourceDist, Identifier, LocalEditable, - Name, PathSourceDist, RemoteSource, SourceDist, + DirectArchiveUrl, DirectGitUrl, Dist, FileLocation, GitSourceDist, LocalEditable, Name, + PathSourceDist, RemoteSource, SourceDist, }; use install_wheel_rs::read_dist_info; use pep508_rs::VerbatimUrl; @@ -203,13 +203,12 @@ impl<'a, T: BuildContext> SourceDistCachedBuilder<'a, T> { } }; - // For registry source distributions, shard by package, then by SHA. - // Ex) `pypi/requests/a673187abc19fe6c` + // For registry source distributions, shard by package, then version. let cache_shard = self.build_context.cache().shard( CacheBucket::BuiltWheels, WheelCache::Index(®istry_source_dist.index) .remote_wheel_dir(registry_source_dist.filename.name.as_ref()) - .join(®istry_source_dist.file.distribution_id().as_str()[..16]), + .join(registry_source_dist.filename.version.to_string()), ); self.url_metadata(