-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Closed
Description
Originally reported by: drcraig72 (Bitbucket: drcraig72, GitHub: Unknown)
Found in the release of setuptools 20.2.1, which vendors in packaging 16.4. It appears that packaging.requirements.Requirement does not comply with PEP-440's "Whitespace between a conditional operator and the following version identifier is optional, as is the whitespace around the commas.", per https://www.python.org/dev/peps/pep-0440/#version-specifiers. Instead, it fails when there is whitespace.
>>> from pkg_resources.extern.packaging.requirements import Requirement
>>> Requirement('Jinja2 >=2.7, <3')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/tmp/v/local/lib/python2.7/site-packages/pkg_resources/_vendor/packaging/requirements.py", line 94, in __init__
requirement_string[e.loc:e.loc + 8]))
pkg_resources._vendor.packaging.requirements.InvalidRequirement: Invalid requirement, parse error at "'<3'"
But it succeeds when the whitespace is removed
>>> Requirement('Jinja2 >=2.7,<3')
<Requirement('Jinja2<3,>=2.7')>
Opened the same ticket on packaging at pypa/packaging#65
Reactions are currently unavailable