Separate cache construction from initialization (#3607)

## Summary

Ensures that we only initialize the cache for commands that require it.

Closes https://github.com/astral-sh/uv/issues/3539.
This commit is contained in:
Charlie Marsh 2024-05-15 12:29:39 -04:00 committed by GitHub
parent 647f38be31
commit 55aedda379
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
14 changed files with 78 additions and 49 deletions

View file

@ -15,7 +15,7 @@ pub(crate) struct CompileArgs {
}
pub(crate) async fn compile(args: CompileArgs) -> anyhow::Result<()> {
let cache = Cache::try_from(args.cache_args)?;
let cache = Cache::try_from(args.cache_args)?.init()?;
let interpreter = if let Some(python) = args.python {
python