Avoid extra-only filtering for constraints (#4095)

## Summary

The "only include if relevant for the extra" filtering should _not_ be
applied to constraints. Otherwise, we'd only constrain when the extra
was included in the constraints file itself, which is incorrect.

Closes https://github.com/astral-sh/uv/issues/4091.
This commit is contained in:
Charlie Marsh 2024-06-06 09:58:46 -04:00 committed by GitHub
parent 39f8978920
commit 8798e91dd5
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 39 additions and 3 deletions

View file

@ -97,6 +97,7 @@ fn add_requirements(
// If the requirement isn't relevant for the current platform, skip it.
match source_extra {
Some(source_extra) => {
// Only include requirements that are relevant for the current extra.
if requirement.evaluate_markers(env, &[]) {
continue;
}
@ -167,9 +168,6 @@ fn add_requirements(
// If the requirement isn't relevant for the current platform, skip it.
match source_extra {
Some(source_extra) => {
if constraint.evaluate_markers(env, &[]) {
continue;
}
if !constraint.evaluate_markers(env, std::slice::from_ref(source_extra)) {
continue;
}