From 605f64c698d18d1c16153ab5389758d0ef7469d0 Mon Sep 17 00:00:00 2001 From: Charlie Marsh Date: Sun, 1 Sep 2024 13:36:13 -0400 Subject: [PATCH] Sort by implementation in uv python list --- crates/uv/src/commands/python/list.rs | 22 +++++++--------------- 1 file changed, 7 insertions(+), 15 deletions(-) diff --git a/crates/uv/src/commands/python/list.rs b/crates/uv/src/commands/python/list.rs index ed012024380d..e1dc8eb89a9b 100644 --- a/crates/uv/src/commands/python/list.rs +++ b/crates/uv/src/commands/python/list.rs @@ -59,13 +59,7 @@ pub(crate) async fn list( .flatten(); for download in downloads { - output.insert(( - download.python_version().version().clone(), - download.os().to_string(), - download.key().clone(), - Kind::Download, - None, - )); + output.insert((download.key().clone(), Kind::Download, None)); } }; @@ -94,9 +88,7 @@ pub(crate) async fn list( Kind::System }; output.insert(( - installation.python_version().clone(), - installation.os().to_string(), - installation.key().clone(), + installation.key(), kind, Some(installation.interpreter().sys_executable().to_path_buf()), )); @@ -106,7 +98,7 @@ pub(crate) async fn list( let mut seen_patch = FxHashSet::default(); let mut seen_paths = FxHashSet::default(); let mut include = Vec::new(); - for (version, os, key, kind, path) in output.iter().rev() { + for (key, kind, path) in output.iter().rev() { // Do not show the same path more than once if let Some(path) = path { if !seen_paths.insert(path) { @@ -116,9 +108,9 @@ pub(crate) async fn list( // Only show the latest patch version for each download unless all were requested if !matches!(kind, Kind::System) { - if let [major, minor, ..] = version.release() { + if let [major, minor, ..] = key.version().release() { if !seen_minor.insert(( - os.clone(), + *key.os(), *major, *minor, key.implementation(), @@ -130,9 +122,9 @@ pub(crate) async fn list( } } } - if let [major, minor, patch] = version.release() { + if let [major, minor, patch] = key.version().release() { if !seen_patch.insert(( - os.clone(), + *key.os(), *major, *minor, *patch,