mirror of
https://github.com/astral-sh/uv.git
synced 2025-11-19 03:28:42 +00:00
Improve simple no version messages using complement of range (#979)
Improves some of the "no versions of <package> are available" messages
by showing the complement or inversion of the package.
Does not address cases like
```
Because there are no versions of crow that satisfy any of:
crow>1.0.0,<2.0.0a5
crow>2.0.0a7,<2.0.0b1
crow>2.0.0b1,<2.0.0b5
...
```
which are a bit more complicated; I'll focus on those cases in a
follow-up.
This commit is contained in:
parent
7bb4fda8af
commit
02ed195982
5 changed files with 48 additions and 77 deletions
|
|
@ -37,11 +37,20 @@ impl ReportFormatter<PubGrubPackage, Range<Version>> for PubGrubReportFormatter<
|
|||
} else if set.as_singleton().is_some() {
|
||||
format!("there is no version of {package}{set}")
|
||||
} else {
|
||||
format!(
|
||||
"there are no versions of {} that satisfy {}",
|
||||
package,
|
||||
PackageRange::compatibility(package, &set)
|
||||
)
|
||||
let complement = set.complement();
|
||||
let segments = complement.iter().collect::<Vec<_>>().len();
|
||||
if segments == 1 {
|
||||
format!(
|
||||
"only {} is available",
|
||||
PackageRange::compatibility(package, &complement)
|
||||
)
|
||||
} else {
|
||||
format!(
|
||||
"there are no versions of {} that satisfy {}",
|
||||
package,
|
||||
PackageRange::compatibility(package, &set)
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
External::UnavailableDependencies(package, set) => {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue