Skip to content

Commit

Permalink
fixup! Adhere to PEP 685 when evaluating markers with extras
Browse files Browse the repository at this point in the history
  • Loading branch information
hroncok committed May 10, 2022
1 parent 029088f commit 90aa8f3
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions packaging/markers.py
Expand Up @@ -5,7 +5,6 @@
import operator
import os
import platform
import re
import sys
from typing import Any, Callable, Dict, List, Optional, Tuple, Union

Expand All @@ -22,6 +21,7 @@
)

from .specifiers import InvalidSpecifier, Specifier
from .utils import canonicalize_name

__all__ = [
"InvalidMarker",
Expand Down Expand Up @@ -223,8 +223,10 @@ def _get_env(environment: Dict[str, str], name: str) -> str:
def _normalize(*values: str, key: str) -> Tuple[str, ...]:
# PEP 685 – Comparison of extra names for optional distribution dependencies
# https://peps.python.org/pep-0685/
# > When comparing extra names, tools MUST normalize the names being
# > compared using the semantics outlined in PEP 503 for names
if key == "extra":
return tuple(re.sub(r"[-_.]+", "-", v).lower() for v in values)
return tuple(canonicalize_name(v) for v in values)

# other environment markes don't have such standards
return values
Expand Down

0 comments on commit 90aa8f3

Please sign in to comment.