Skip to content

Commit 605f64c

Browse files
committed
Sort by implementation in uv python list
1 parent ff39950 commit 605f64c

File tree

1 file changed

+7
-15
lines changed
  • crates/uv/src/commands/python

1 file changed

+7
-15
lines changed

crates/uv/src/commands/python/list.rs

Lines changed: 7 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -59,13 +59,7 @@ pub(crate) async fn list(
5959
.flatten();
6060

6161
for download in downloads {
62-
output.insert((
63-
download.python_version().version().clone(),
64-
download.os().to_string(),
65-
download.key().clone(),
66-
Kind::Download,
67-
None,
68-
));
62+
output.insert((download.key().clone(), Kind::Download, None));
6963
}
7064
};
7165

@@ -94,9 +88,7 @@ pub(crate) async fn list(
9488
Kind::System
9589
};
9690
output.insert((
97-
installation.python_version().clone(),
98-
installation.os().to_string(),
99-
installation.key().clone(),
91+
installation.key(),
10092
kind,
10193
Some(installation.interpreter().sys_executable().to_path_buf()),
10294
));
@@ -106,7 +98,7 @@ pub(crate) async fn list(
10698
let mut seen_patch = FxHashSet::default();
10799
let mut seen_paths = FxHashSet::default();
108100
let mut include = Vec::new();
109-
for (version, os, key, kind, path) in output.iter().rev() {
101+
for (key, kind, path) in output.iter().rev() {
110102
// Do not show the same path more than once
111103
if let Some(path) = path {
112104
if !seen_paths.insert(path) {
@@ -116,9 +108,9 @@ pub(crate) async fn list(
116108

117109
// Only show the latest patch version for each download unless all were requested
118110
if !matches!(kind, Kind::System) {
119-
if let [major, minor, ..] = version.release() {
111+
if let [major, minor, ..] = key.version().release() {
120112
if !seen_minor.insert((
121-
os.clone(),
113+
*key.os(),
122114
*major,
123115
*minor,
124116
key.implementation(),
@@ -130,9 +122,9 @@ pub(crate) async fn list(
130122
}
131123
}
132124
}
133-
if let [major, minor, patch] = version.release() {
125+
if let [major, minor, patch] = key.version().release() {
134126
if !seen_patch.insert((
135-
os.clone(),
127+
*key.os(),
136128
*major,
137129
*minor,
138130
*patch,

0 commit comments

Comments
 (0)