Colocate Python install cache with destination directory (#6043)

## Summary

Closes https://github.com/astral-sh/uv/issues/6036.
This commit is contained in:
Charlie Marsh 2024-08-12 16:15:30 -04:00 committed by GitHub
parent e27a1fce60
commit ae7a8d7f33
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 27 additions and 19 deletions

View file

@ -1,11 +1,11 @@
use std::fmt;
use std::str::FromStr;
use pep440_rs::Version;
use tracing::{debug, info};
use uv_client::BaseClientBuilder;
use pep440_rs::Version;
use uv_cache::Cache;
use uv_client::BaseClientBuilder;
use crate::discovery::{
find_best_python_installation, find_python_installation, EnvironmentPreference, PythonRequest,
@ -123,6 +123,7 @@ impl PythonInstallation {
) -> Result<Self, Error> {
let installations = ManagedPythonInstallations::from_settings()?.init()?;
let installations_dir = installations.root();
let cache_dir = installations.cache();
let _lock = installations.acquire_lock()?;
let download = ManagedPythonDownload::from_request(&request)?;
@ -130,7 +131,7 @@ impl PythonInstallation {
info!("Fetching requested Python...");
let result = download
.fetch(&client, installations_dir, cache, reporter)
.fetch(&client, installations_dir, &cache_dir, reporter)
.await?;
let path = match result {