From 828a7d336301af2b62e20d922c2dd84cee065e40 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Bidoul?= Date: Sun, 1 Oct 2023 14:43:37 +0200 Subject: [PATCH] Remove various extras normalization workarounds --- src/pip/_internal/req/req_install.py | 8 +------- src/pip/_internal/resolution/resolvelib/candidates.py | 10 +--------- 2 files changed, 2 insertions(+), 16 deletions(-) diff --git a/src/pip/_internal/req/req_install.py b/src/pip/_internal/req/req_install.py index f8957e5d994..1fe76644d3b 100644 --- a/src/pip/_internal/req/req_install.py +++ b/src/pip/_internal/req/req_install.py @@ -51,7 +51,6 @@ is_installable_dir, redact_auth_from_url, ) -from pip._internal.utils.packaging import safe_extra from pip._internal.utils.subprocess import runner_with_spinner_message from pip._internal.utils.temp_dir import TempDirectory, tempdir_kinds from pip._internal.utils.unpacking import unpack_file @@ -272,12 +271,7 @@ def match_markers(self, extras_requested: Optional[Iterable[str]] = None) -> boo extras_requested = ("",) if self.markers is not None: return any( - self.markers.evaluate({"extra": extra}) - # TODO: Remove these two variants when packaging is upgraded to - # support the marker comparison logic specified in PEP 685. - or self.markers.evaluate({"extra": safe_extra(extra)}) - or self.markers.evaluate({"extra": canonicalize_name(extra)}) - for extra in extras_requested + self.markers.evaluate({"extra": extra}) for extra in extras_requested ) else: return True diff --git a/src/pip/_internal/resolution/resolvelib/candidates.py b/src/pip/_internal/resolution/resolvelib/candidates.py index 7a139d86b5d..4c14858c81c 100644 --- a/src/pip/_internal/resolution/resolvelib/candidates.py +++ b/src/pip/_internal/resolution/resolvelib/candidates.py @@ -430,14 +430,6 @@ def __init__( ) -> None: self.base = base self.extras = frozenset(canonicalize_name(e) for e in extras) - # If any extras are requested in their non-normalized forms, keep track - # of their raw values. This is needed when we look up dependencies - # since PEP 685 has not been implemented for marker-matching, and using - # the non-normalized extra for lookup ensures the user can select a - # non-normalized extra in a package with its non-normalized form. - # TODO: Remove this attribute when packaging is upgraded to support the - # marker comparison logic specified in PEP 685. - self._unnormalized_extras = extras.difference(self.extras) def __str__(self) -> str: name, rest = str(self.base).split(" ", 1) @@ -523,7 +515,7 @@ def _calculate_valid_requested_extras(self) -> FrozenSet[str]: candidate doesn't support. Any unsupported extras are dropped, and each cause a warning to be logged here. """ - requested_extras = self.extras.union(self._unnormalized_extras) + requested_extras = self.extras valid_extras = frozenset( extra for extra in requested_extras