diff --git a/crates/puffin-cli/src/commands/pip_sync.rs b/crates/puffin-cli/src/commands/pip_sync.rs index fc01860ae..6c7dbfb55 100644 --- a/crates/puffin-cli/src/commands/pip_sync.rs +++ b/crates/puffin-cli/src/commands/pip_sync.rs @@ -138,7 +138,6 @@ pub(crate) async fn sync_requirements( }; // Download any missing distributions. - let staging = tempfile::tempdir()?; let downloads = if remote.is_empty() { vec![] } else { @@ -147,9 +146,7 @@ pub(crate) async fn sync_requirements( let downloader = puffin_installer::Downloader::new(&client, cache) .with_reporter(DownloadReporter::from(printer).with_length(remote.len() as u64)); - let downloads = downloader - .download(remote, cache.unwrap_or(staging.path())) - .await?; + let downloads = downloader.download(remote).await?; let s = if downloads.len() == 1 { "" } else { "s" }; writeln!( @@ -167,6 +164,7 @@ pub(crate) async fn sync_requirements( }; // Unzip any downloaded distributions. + let staging = tempfile::tempdir()?; let unzips = if downloads.is_empty() { vec![] } else { diff --git a/crates/puffin-dispatch/src/lib.rs b/crates/puffin-dispatch/src/lib.rs index 57ac86215..25cf6c3d1 100644 --- a/crates/puffin-dispatch/src/lib.rs +++ b/crates/puffin-dispatch/src/lib.rs @@ -138,7 +138,6 @@ impl BuildContext for BuildDispatch { }; // Download any missing distributions. - let staging = tempfile::tempdir()?; let downloads = if remote.is_empty() { vec![] } else { @@ -148,12 +147,13 @@ impl BuildContext for BuildDispatch { remote.iter().map(ToString::to_string).join(", ") ); Downloader::new(&self.client, self.cache.as_deref()) - .download(remote, self.cache.as_deref().unwrap_or(staging.path())) + .download(remote) .await .context("Failed to download build dependencies")? }; // Unzip any downloaded distributions. + let staging = tempfile::tempdir()?; let unzips = if downloads.is_empty() { vec![] } else { diff --git a/crates/puffin-installer/src/downloader.rs b/crates/puffin-installer/src/downloader.rs index 961a6f414..724c6d3f2 100644 --- a/crates/puffin-installer/src/downloader.rs +++ b/crates/puffin-installer/src/downloader.rs @@ -12,7 +12,6 @@ use pep440_rs::Version; use puffin_client::RegistryClient; use puffin_package::package_name::PackageName; -use crate::cache::WheelCache; use crate::distribution::RemoteDistribution; pub struct Downloader<'a> { @@ -44,12 +43,7 @@ impl<'a> Downloader<'a> { pub async fn download( &'a self, wheels: Vec, - target: &'a Path, ) -> Result> { - // Create the wheel cache subdirectory, if necessary. - let wheel_cache = WheelCache::new(target); - wheel_cache.init()?; - // Sort the wheels by size. let mut wheels = wheels; wheels.sort_unstable_by_key(|wheel| Reverse(wheel.file().size));