Do not error when the Python bin directory is missing on `uv python uninstall` (#8725)

This commit is contained in:
Zanie Blue 2024-10-31 09:15:47 -05:00 committed by GitHub
parent ad896c89d9
commit b52f229862
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 7 additions and 4 deletions

View File

@ -126,7 +126,9 @@ async fn do_uninstall(
// Collect files in a directory // Collect files in a directory
let executables = python_executable_dir()? let executables = python_executable_dir()?
.read_dir()? .read_dir()
.into_iter()
.flatten()
.filter_map(|entry| match entry { .filter_map(|entry| match entry {
Ok(entry) => Some(entry), Ok(entry) => Some(entry),
Err(err) => { Err(err) => {

View File

@ -74,13 +74,14 @@ fn python_install() {
"###); "###);
uv_snapshot!(context.filters(), context.python_uninstall().arg("3.13"), @r###" uv_snapshot!(context.filters(), context.python_uninstall().arg("3.13"), @r###"
success: false success: true
exit_code: 2 exit_code: 0
----- stdout ----- ----- stdout -----
----- stderr ----- ----- stderr -----
Searching for Python versions matching: Python 3.13 Searching for Python versions matching: Python 3.13
error: No such file or directory (os error 2) Uninstalled Python 3.13.0 in [TIME]
- cpython-3.13.0-[PLATFORM]
"###); "###);
} }