Use cached environments for --with layers (#5897)

## Summary

I think this will make the logging changes a little easier by having
more consistency between codepaths.
This commit is contained in:
Charlie Marsh
2024-08-07 19:31:43 -04:00
committed by GitHub
parent bc1d7764e2
commit 4b2b2d2870
+28 -30
View File
@@ -453,40 +453,38 @@ pub(crate) async fn run(
// "installed" packages, so that we can skip re-installing them in the ephemeral
// environment.
// Create a virtual environment
temp_dir = cache.environment()?;
let venv = uv_virtualenv::create_venv(
temp_dir.path(),
interpreter,
uv_virtualenv::Prompt::None,
false,
false,
false,
)?;
match spec {
None => Some(venv),
Some(spec) if spec.is_empty() => Some(venv),
Some(match spec.filter(|spec| !spec.is_empty()) {
None => {
// Create a virtual environment
temp_dir = cache.environment()?;
uv_virtualenv::create_venv(
temp_dir.path(),
interpreter,
uv_virtualenv::Prompt::None,
false,
false,
false,
)?
}
Some(spec) => {
debug!("Syncing ephemeral requirements");
// Install the ephemeral requirements.
Some(
project::update_environment(
venv,
spec,
&settings,
&state,
preview,
connectivity,
concurrency,
native_tls,
cache,
printer.filter(show_resolution),
)
.await?,
CachedEnvironment::get_or_create(
spec,
interpreter,
&settings,
&state,
preview,
connectivity,
concurrency,
native_tls,
cache,
printer.filter(show_resolution),
)
.await?
.into()
}
}
})
};
// If we're running in an ephemeral environment, add a `sitecustomize.py` to enable loading of