mirror of
https://github.com/astral-sh/uv.git
synced 2025-10-21 07:42:05 +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
|
@ -208,7 +208,7 @@ pub enum PythonInstallationKeyError {
|
|||
ParseError(String, String),
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, PartialEq, Eq)]
|
||||
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
|
||||
pub struct PythonInstallationKey {
|
||||
pub(crate) implementation: LenientImplementationName,
|
||||
pub(crate) major: u8,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue