mirror of
https://github.com/astral-sh/uv.git
synced 2025-10-17 05:47:45 +00:00
Deduplicate when install or uninstall python (#4841)
When specifying the same argument multiple times, the same version will be downloaded multiple times: ```sh $ cargo run -- python install --preview --force 3.12.3 cpython-3.12 3.12.3 3.12 Looking for installation Python 3.12.3 (any-3.12.3-any-any-any) Looking for installation cpython-3.12-any-any-any (cpython-3.12-any-any-any) Looking for installation Python 3.12.3 (any-3.12.3-any-any-any) Looking for installation Python 3.12 (any-3.12-any-any-any) Found 4/4 versions requiring installation Downloading cpython-3.12.3-windows-x86_64-none Downloading cpython-3.12.3-windows-x86_64-none Downloading cpython-3.12.3-windows-x86_64-none Downloading cpython-3.12.3-windows-x86_64-none ``` This PR deduplicates the `ManagedPythonDownload` before `install` or `uninstall`: ```sh $ cargo run -q -- python install --preview --force 3.12.3 cpython-3.12 3.12.3 3.12 Looking for installation Python 3.12 (any-3.12-any-any-any) Looking for installation Python 3.12.3 (any-3.12.3-any-any-any) Looking for installation cpython-3.12-any-any-any (cpython-3.12-any-any-any) Downloading cpython-3.12.3-windows-x86_64-none Installed Python 3.12.3 to C:\Users\nigel\AppData\Roaming\uv\data\python\cpython-3.12.3-windows-x86_64-none Installed 1 version in 6s $ cargo run -q -- python uninstall --preview 3.12.3 cpython-3.12 3.12.3 3.12 Looking for Python installations matching Python 3.12 (any-3.12-any-any-any) Found installation `cpython-3.12.3-windows-x86_64-none` that matches Python 3.12 Looking for Python installations matching Python 3.12.3 (any-3.12.3-any-any-any) Looking for Python installations matching cpython-3.12-any-any-any (cpython-3.12-any-any-any) Uninstalled `cpython-3.12.3-windows-x86_64-none` Removed 1 Python installation ```
This commit is contained in:
parent
1bd73a7346
commit
bcb2568f47
6 changed files with 24 additions and 18 deletions
|
@ -229,7 +229,7 @@ Error=This Python installation is managed by uv and should not be modified.
|
|||
";
|
||||
|
||||
/// A uv-managed Python installation on the current system..
|
||||
#[derive(Debug, Clone, Eq, PartialEq, Ord, PartialOrd)]
|
||||
#[derive(Debug, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
|
||||
pub struct ManagedPythonInstallation {
|
||||
/// The path to the top-level directory of the installed Python.
|
||||
path: PathBuf,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue