Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sort by implementation in uv python list #6918

Merged
merged 1 commit into from
Sep 4, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 7 additions & 15 deletions crates/uv/src/commands/python/list.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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));
}
};

Expand Down Expand Up @@ -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()),
));
Expand All @@ -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) {
Expand All @@ -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(),
Expand All @@ -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,
Expand Down
Loading