Commit 78d2a3bf authored by Jason R. Coombs's avatar Jason R. Coombs Committed by GitHub

Merge pull request #2137 from pypa/debt/remove-RequirementParseError

Remove superfluous RequirementParseError
parents 776fa9ff 08e85880
Removed (private) pkg_resources.RequirementParseError, now replaced by packaging.requirements.InvalidRequirement. Kept the name for compatibility, but users should catch InvalidRequirement instead.
...@@ -3077,11 +3077,6 @@ def issue_warning(*args, **kw): ...@@ -3077,11 +3077,6 @@ def issue_warning(*args, **kw):
warnings.warn(stacklevel=level + 1, *args, **kw) warnings.warn(stacklevel=level + 1, *args, **kw)
class RequirementParseError(ValueError):
def __str__(self):
return ' '.join(self.args)
def parse_requirements(strs): def parse_requirements(strs):
"""Yield ``Requirement`` objects for each specification in `strs` """Yield ``Requirement`` objects for each specification in `strs`
...@@ -3104,13 +3099,14 @@ def parse_requirements(strs): ...@@ -3104,13 +3099,14 @@ def parse_requirements(strs):
yield Requirement(line) yield Requirement(line)
class RequirementParseError(packaging.requirements.InvalidRequirement):
"Compatibility wrapper for InvalidRequirement"
class Requirement(packaging.requirements.Requirement): class Requirement(packaging.requirements.Requirement):
def __init__(self, requirement_string): def __init__(self, requirement_string):
"""DO NOT CALL THIS UNDOCUMENTED METHOD; use Requirement.parse()!""" """DO NOT CALL THIS UNDOCUMENTED METHOD; use Requirement.parse()!"""
try: super(Requirement, self).__init__(requirement_string)
super(Requirement, self).__init__(requirement_string)
except packaging.requirements.InvalidRequirement as e:
raise RequirementParseError(str(e))
self.unsafe_name = self.name self.unsafe_name = self.name
project_name = safe_name(self.name) project_name = safe_name(self.name)
self.project_name, self.key = project_name, project_name.lower() self.project_name, self.key = project_name, project_name.lower()
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment