Simplify supported environments when comparing to lockfile (#7894)

## Summary

If a supported environment includes a Python marker, we don't simplify
it out, despite _storing_ the simplified markers. This PR modifies the
validation code to compare simplified to simplified markers.

Closes https://github.com/astral-sh/uv/issues/7876.
This commit is contained in:
Charlie Marsh 2024-10-03 14:15:07 +01:00 committed by GitHub
parent 005bb235f0
commit 8962bcb028
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 152 additions and 20 deletions

View file

@ -524,10 +524,17 @@ impl Lock {
pub fn simplified_supported_environments(&self) -> Vec<MarkerTree> {
self.supported_environments()
.iter()
.map(|marker| self.requires_python.simplify_markers(marker.clone()))
.cloned()
.map(|marker| self.simplify_environment(marker))
.collect()
}
/// Simplify the given marker environment with respect to the lockfile's
/// `requires-python` setting.
pub fn simplify_environment(&self, marker: MarkerTree) -> MarkerTree {
self.requires_python.simplify_markers(marker)
}
/// If this lockfile was built from a forking resolution with non-identical forks, return the
/// markers of those forks, otherwise `None`.
pub fn fork_markers(&self) -> &[MarkerTree] {