Skip to content

Commit

Permalink
Remove now redundant error detection
Browse files Browse the repository at this point in the history
This specifier syntax check is now done by the packaging library.
  • Loading branch information
sbidoul committed Oct 1, 2023
1 parent 80ec609 commit fd89669
Showing 1 changed file with 1 addition and 12 deletions.
13 changes: 1 addition & 12 deletions src/pip/_internal/req/constructors.py
Original file line number Diff line number Diff line change
Expand Up @@ -338,7 +338,7 @@ def with_source(text: str) -> str:

def _parse_req_string(req_as_string: str) -> Requirement:
try:
req = get_requirement(req_as_string)
return get_requirement(req_as_string)
except InvalidRequirement:
if os.path.sep in req_as_string:
add_msg = "It looks like a path."
Expand All @@ -353,17 +353,6 @@ def _parse_req_string(req_as_string: str) -> Requirement:
if add_msg:
msg += f"\nHint: {add_msg}"
raise InstallationError(msg)
else:
# Deprecate extras after specifiers: "name>=1.0[extras]"
# This currently works by accident because _strip_extras() parses
# any extras in the end of the string and those are saved in
# RequirementParts
for spec in req.specifier:
spec_str = str(spec)
if spec_str.endswith("]"):
msg = f"Extras after version '{spec_str}'."
raise InstallationError(msg)
return req

if req_as_string is not None:
req: Optional[Requirement] = _parse_req_string(req_as_string)
Expand Down

0 comments on commit fd89669

Please sign in to comment.