Remove unused wheel cache argument from downloader (#248)

This commit is contained in:
Charlie Marsh 2023-10-30 19:23:50 -07:00 committed by GitHub
parent ae203f998a
commit 2f38701008
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 4 additions and 12 deletions

View file

@ -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 {

View file

@ -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 {

View file

@ -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<RemoteDistribution>,
target: &'a Path,
) -> Result<Vec<InMemoryDistribution>> {
// 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));