uv python install: remove the existing version only after the new installation is downloaded successfully (#8485)

## Summary

This PR delays the removal of an existing version after downloading the
new version when running `uv python install --reinstall`.

If the download fails, we can keep the existing version working.

## Test Plan

```console
$ cargo run -- python install 3.13
$ cargo run -- python install --reinstall 3.13 # when downloading, `ctrl-c` to interrupt
$ cargo run -- python list
```
This commit is contained in:
Jo
2024-10-24 02:43:09 +08:00
committed by GitHub
parent 9ca1f0003f
commit 56f93d9cfc
3 changed files with 18 additions and 7 deletions
+1 -1
View File
@@ -132,7 +132,7 @@ impl PythonInstallation {
info!("Fetching requested Python...");
let result = download
.fetch(&client, installations_dir, &cache_dir, reporter)
.fetch(&client, installations_dir, &cache_dir, false, reporter)
.await?;
let path = match result {