Improve phrasing for single term incompatibilities (#9953)

It makes more sense to say "cannot be used" rather than "is
incompatible" when the term is a single package
This commit is contained in:
Zanie Blue 2024-12-17 08:14:33 -06:00 committed by GitHub
parent dde9a79fe7
commit 686f383fa4
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 6 additions and 26 deletions

View File

@ -204,12 +204,8 @@ impl ReportFormatter<PubGrubPackage, Range<Version>, UnavailableReason>
_ => (),
}
}
if let [(p, t)] = slice {
if PackageTerm::new(p, t, self).plural() {
result.push_str(" are incompatible");
} else {
result.push_str(" is incompatible");
}
if slice.len() == 1 {
result.push_str(" cannot be used");
} else {
result.push_str(" are incompatible");
}
@ -1444,22 +1440,6 @@ impl PackageTerm<'_> {
formatter,
}
}
/// Returns `true` if the predicate following this package term should be singular or plural.
fn plural(&self) -> bool {
match self.term {
Term::Positive(set) => self.formatter.compatible_range(self.package, set).plural(),
Term::Negative(set) => {
if set.as_singleton().is_some() {
false
} else {
self.formatter
.compatible_range(self.package, &set.complement())
.plural()
}
}
}
}
}
/// The kind of version ranges being displayed in [`PackageRange`]

View File

@ -3232,7 +3232,7 @@ fn lock_requires_python() -> Result<()> {
----- stderr -----
× No solution found when resolving dependencies for split (python_full_version >= '3.7' and python_full_version < '3.7.9'):
Because the requested Python version (>=3.7) does not satisfy Python>=3.8 and the requested Python version (>=3.7) does not satisfy Python>=3.7.9,<3.8, we can conclude that Python>=3.7.9 is incompatible.
Because the requested Python version (>=3.7) does not satisfy Python>=3.8 and the requested Python version (>=3.7) does not satisfy Python>=3.7.9,<3.8, we can conclude that Python>=3.7.9 cannot be used.
And because pygls>=1.1.0,<=1.2.1 depends on Python>=3.7.9,<4 and only pygls<=1.3.0 is available, we can conclude that all of:
pygls>=1.1.0,<1.3.0
pygls>1.3.0

View File

@ -3725,15 +3725,15 @@ fn python_greater_than_current_excluded() {
Because the current Python version (3.9.[X]) does not satisfy Python>=3.10,<3.11 and the current Python version (3.9.[X]) does not satisfy Python>=3.12, we can conclude that all of:
Python>=3.10,<3.11
Python>=3.12
are incompatible.
And because the current Python version (3.9.[X]) does not satisfy Python>=3.11,<3.12, we can conclude that Python>=3.10 is incompatible.
cannot be used.
And because the current Python version (3.9.[X]) does not satisfy Python>=3.11,<3.12, we can conclude that Python>=3.10 cannot be used.
And because package-a==2.0.0 depends on Python>=3.10 and only the following versions of package-a are available:
package-a<=2.0.0
package-a==3.0.0
package-a==4.0.0
we can conclude that package-a>=2.0.0,<3.0.0 cannot be used. (1)
Because the current Python version (3.9.[X]) does not satisfy Python>=3.11,<3.12 and the current Python version (3.9.[X]) does not satisfy Python>=3.12, we can conclude that Python>=3.11 is incompatible.
Because the current Python version (3.9.[X]) does not satisfy Python>=3.11,<3.12 and the current Python version (3.9.[X]) does not satisfy Python>=3.12, we can conclude that Python>=3.11 cannot be used.
And because package-a==3.0.0 depends on Python>=3.11, we can conclude that package-a==3.0.0 cannot be used.
And because we know from (1) that package-a>=2.0.0,<3.0.0 cannot be used, we can conclude that package-a>=2.0.0,<4.0.0 cannot be used. (2)