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

wip: experimental support for version ranges in unsat errors #28

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
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
16 changes: 11 additions & 5 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ pub trait SolvableDisplay<VS: VersionSet, Name: PackageName = String> {
/// A method that is used to display multiple solvables in a user friendly way.
/// For example the conda provider should only display the versions (not build strings etc.)
/// and merges multiple solvables into one line.
fn display_candidates(&self, pool: &Pool<VS, Name>, candidates: &[SolvableId]) -> String;
fn display_candidates(&self, pool: &Pool<VS, Name>, candidates: &[Vec<SolvableId>]) -> String;
}

/// Display merged candidates on single line with `|` as separator.
Expand All @@ -170,13 +170,19 @@ where
fn display_candidates(
&self,
pool: &Pool<VS, Name>,
merged_candidates: &[SolvableId],
merged_candidates: &[Vec<SolvableId>],
) -> String {
merged_candidates
.iter()
.map(|&id| &pool.resolve_solvable(id).inner)
.sorted()
.map(|s| s.to_string())
.map(|ids| {
if ids.len() == 1 {
pool.resolve_solvable(ids[0]).inner.to_string()
} else {
let highest = &pool.resolve_solvable(ids[0]).inner;
let lowest = &pool.resolve_solvable(*ids.last().unwrap()).inner;
format!(">={lowest}, <={highest}")
}
})
.join(" | ")
}
}
Loading