Add retries for Python downloads (#9274)

## Summary

This uses the same approach as in the rest of uv, but with another
dedicated method for retries.

Closes https://github.com/astral-sh/uv/issues/8525.
This commit is contained in:
Charlie Marsh 2024-11-20 09:42:42 -05:00 committed by GitHub
parent 289771e311
commit 1b13036674
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
16 changed files with 107 additions and 54 deletions

View file

@ -86,8 +86,8 @@ impl PythonInstallation {
client_builder: &BaseClientBuilder<'a>,
cache: &Cache,
reporter: Option<&dyn Reporter>,
python_install_mirror: Option<String>,
pypy_install_mirror: Option<String>,
python_install_mirror: Option<&str>,
pypy_install_mirror: Option<&str>,
) -> Result<Self, Error> {
let request = request.unwrap_or_else(|| &PythonRequest::Default);
@ -132,8 +132,8 @@ impl PythonInstallation {
client_builder: &BaseClientBuilder<'a>,
cache: &Cache,
reporter: Option<&dyn Reporter>,
python_install_mirror: Option<String>,
pypy_install_mirror: Option<String>,
python_install_mirror: Option<&str>,
pypy_install_mirror: Option<&str>,
) -> Result<Self, Error> {
let installations = ManagedPythonInstallations::from_settings()?.init()?;
let installations_dir = installations.root();
@ -145,7 +145,7 @@ impl PythonInstallation {
info!("Fetching requested Python...");
let result = download
.fetch(
.fetch_with_retry(
&client,
installations_dir,
&cache_dir,