From a4c51ad43bc81d7eb557450698c9148b6776388d Mon Sep 17 00:00:00 2001 From: Zanie Blue Date: Thu, 31 Oct 2024 09:06:39 -0500 Subject: [PATCH] Do not error when the Python bin directory is missing on `uv python uninstall` --- crates/uv/src/commands/python/uninstall.rs | 4 +++- crates/uv/tests/it/python_install.rs | 7 ++++--- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/crates/uv/src/commands/python/uninstall.rs b/crates/uv/src/commands/python/uninstall.rs index f74085cf4768..d1acd30f2336 100644 --- a/crates/uv/src/commands/python/uninstall.rs +++ b/crates/uv/src/commands/python/uninstall.rs @@ -126,7 +126,9 @@ async fn do_uninstall( // Collect files in a directory let executables = python_executable_dir()? - .read_dir()? + .read_dir() + .into_iter() + .flatten() .filter_map(|entry| match entry { Ok(entry) => Some(entry), Err(err) => { diff --git a/crates/uv/tests/it/python_install.rs b/crates/uv/tests/it/python_install.rs index ca939a502a7f..2300484083c7 100644 --- a/crates/uv/tests/it/python_install.rs +++ b/crates/uv/tests/it/python_install.rs @@ -74,13 +74,14 @@ fn python_install() { "###); uv_snapshot!(context.filters(), context.python_uninstall().arg("3.13"), @r###" - success: false - exit_code: 2 + success: true + exit_code: 0 ----- stdout ----- ----- stderr ----- 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] "###); }