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

Show all PyPy versions in uv python list --all-versions #6917

Merged
merged 1 commit into from
Sep 3, 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
30 changes: 22 additions & 8 deletions crates/uv/src/commands/python/list.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
use std::collections::{BTreeSet, HashSet};
use std::collections::BTreeSet;
use std::fmt::Write;

use anyhow::Result;
use owo_colors::OwoColorize;

use rustc_hash::FxHashSet;
use uv_cache::Cache;
use uv_fs::Simplified;
use uv_python::downloads::PythonDownloadRequest;
Expand Down Expand Up @@ -102,9 +102,9 @@ pub(crate) async fn list(
));
}

let mut seen_minor = HashSet::new();
let mut seen_patch = HashSet::new();
let mut seen_paths = HashSet::new();
let mut seen_minor = FxHashSet::default();
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() {
// Do not show the same path more than once
Expand All @@ -117,15 +117,29 @@ 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 !seen_minor.insert((os.clone(), *major, *minor, *key.arch(), *key.libc())) {
if !seen_minor.insert((
os.clone(),
*major,
*minor,
key.implementation(),
*key.arch(),
*key.libc(),
)) {
if matches!(kind, Kind::Download) && !all_versions {
continue;
}
}
}
if let [major, minor, patch] = version.release() {
if !seen_patch.insert((os.clone(), *major, *minor, *patch, *key.arch(), key.libc()))
{
if !seen_patch.insert((
os.clone(),
*major,
*minor,
*patch,
key.implementation(),
*key.arch(),
key.libc(),
)) {
if matches!(kind, Kind::Download) {
continue;
}
Expand Down
Loading