Skip to content

Commit

Permalink
Remove various extras normalization workarounds
Browse files Browse the repository at this point in the history
  • Loading branch information
sbidoul committed Oct 1, 2023
1 parent fd89669 commit 828a7d3
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 16 deletions.
8 changes: 1 addition & 7 deletions src/pip/_internal/req/req_install.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
10 changes: 1 addition & 9 deletions src/pip/_internal/resolution/resolvelib/candidates.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 828a7d3

Please sign in to comment.