Cache the setup.py resolution (#327)

Cache the resolution for the setup.py requirements (`pip`, `setuptools`,
`wheels`) across builds.
This commit is contained in:
konsti 2023-11-06 15:14:24 +01:00 committed by GitHub
parent b2439b24a1
commit d99ca3159b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 41 additions and 21 deletions

View file

@ -13,7 +13,7 @@ use tracing::{debug, instrument};
use pep508_rs::Requirement;
use platform_tags::Tags;
use puffin_build::SourceDistributionBuilder;
use puffin_build::{SourceDistributionBuild, SourceDistributionBuildContext};
use puffin_client::RegistryClient;
use puffin_installer::{Builder, Downloader, Installer, PartitionedRequirements, Unzipper};
use puffin_interpreter::{InterpreterInfo, Virtualenv};
@ -27,6 +27,7 @@ pub struct BuildDispatch {
cache: PathBuf,
interpreter_info: InterpreterInfo,
base_python: PathBuf,
source_distribution_builder: SourceDistributionBuildContext,
}
impl BuildDispatch {
@ -41,6 +42,7 @@ impl BuildDispatch {
cache,
interpreter_info,
base_python,
source_distribution_builder: SourceDistributionBuildContext::default(),
}
}
}
@ -228,9 +230,14 @@ impl BuildContext for BuildDispatch {
wheel_dir: &'a Path,
) -> Pin<Box<dyn Future<Output = Result<String>> + Send + 'a>> {
Box::pin(async move {
let builder =
SourceDistributionBuilder::setup(sdist, subdirectory, &self.interpreter_info, self)
.await?;
let builder = SourceDistributionBuild::setup(
sdist,
subdirectory,
&self.interpreter_info,
self,
self.source_distribution_builder.clone(),
)
.await?;
Ok(builder.build(wheel_dir)?)
})
}