Normalize extras when evaluating PEP 508 markers (#915)

## Summary

We always normalize extra names in our requirements (e.g., `cuda12_pip`
to `cuda12-pip`), but we weren't normalizing within PEP 508 markers,
which meant we ended up comparing `cuda12-pip` (normalized) against
`cuda12_pip` (unnormalized).

Closes https://github.com/astral-sh/puffin/issues/911.
This commit is contained in:
Charlie Marsh 2024-01-14 12:16:54 -05:00 committed by GitHub
parent a99e5e00f2
commit 0374000ec0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 84 additions and 52 deletions

View file

@ -37,7 +37,7 @@ impl PubGrubDependencies {
// If the requirement isn't relevant for the current platform, skip it.
if let Some(extra) = extra {
if !requirement.evaluate_markers(env, &[extra.as_ref()]) {
if !requirement.evaluate_markers(env, std::slice::from_ref(extra)) {
continue;
}
} else {
@ -89,7 +89,7 @@ impl PubGrubDependencies {
// If the requirement isn't relevant for the current platform, skip it.
if let Some(extra) = extra {
if !constraint.evaluate_markers(env, &[extra.as_ref()]) {
if !constraint.evaluate_markers(env, std::slice::from_ref(extra)) {
continue;
}
} else {