Avoid showing negations of ranges in error messages (#981)

Closes https://github.com/astral-sh/puffin/issues/980
This commit is contained in:
Zanie Blue 2024-01-19 11:07:14 -06:00 committed by GitHub
parent 02ed195982
commit ae7a2cddc2
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 7 additions and 3 deletions

View file

@ -433,7 +433,11 @@ impl std::fmt::Display for PackageTerm<'_> {
let package = self.package; let package = self.package;
write!(f, "{package}!={version}") write!(f, "{package}!={version}")
} else { } else {
write!(f, "!( {} )", PackageRange::compatibility(self.package, set)) write!(
f,
"{}",
PackageRange::compatibility(self.package, &set.complement())
)
} }
} }
} }

View file

@ -695,10 +695,10 @@ fn dependency_excludes_non_contiguous_range_of_compatible_versions() -> Result<(
albatross>1.0.0,<2.0.0 albatross>1.0.0,<2.0.0
we can conclude that albatross<2.0.0 depends on bluebird==1.0.0. we can conclude that albatross<2.0.0 depends on bluebird==1.0.0.
And because we know from (1) that crow<2.0.0 depends on albatross<2.0.0, we can conclude that crow<2.0.0 depends on bluebird==1.0.0. And because we know from (1) that crow<2.0.0 depends on albatross<2.0.0, we can conclude that crow<2.0.0 depends on bluebird==1.0.0.
And because crow==2.0.0 depends on albatross>=3.0.0 we can conclude that all versions of crow, bluebird!=1.0.0, !( albatross>=3.0.0 ) are incompatible. (2) And because crow==2.0.0 depends on albatross>=3.0.0 we can conclude that all versions of crow, bluebird!=1.0.0, albatross<3.0.0 are incompatible. (2)
Because albatross==3.0.0 depends on bluebird==3.0.0 and only albatross<=3.0.0 is available, we can conclude that albatross>=3.0.0 depends on bluebird==3.0.0. Because albatross==3.0.0 depends on bluebird==3.0.0 and only albatross<=3.0.0 is available, we can conclude that albatross>=3.0.0 depends on bluebird==3.0.0.
And because we know from (2) that all versions of crow, bluebird!=1.0.0, !( albatross>=3.0.0 ) are incompatible, we can conclude that all versions of crow depend on one of: And because we know from (2) that all versions of crow, bluebird!=1.0.0, albatross<3.0.0 are incompatible, we can conclude that all versions of crow depend on one of:
bluebird<=1.0.0 bluebird<=1.0.0
bluebird>=3.0.0 bluebird>=3.0.0