-
Notifications
You must be signed in to change notification settings - Fork 270
Closed
Description
$ python3
Python 3.6.4 (default, Jan 6 2018, 02:24:08)
[GCC 7.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import packaging.requirements
>>> packaging.requirements.Requirement("pip @ file://localhost/localbuilds/pip-1.3.1-py33-none-any.whl")
<Requirement('pip@ file://localhost/localbuilds/pip-1.3.1-py33-none-any.whl')>
>>> packaging.requirements.Requirement("pip @ file:///localbuilds/pip-1.3.1-py33-none-any.whl")
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/uken/.local/lib64/python3.6/site-packages/packaging/requirements.py", line 101, in __init__
raise InvalidRequirement("Invalid URL given")
packaging.requirements.InvalidRequirement: Invalid URL given
According to PEP 508 the following strings should all be parseable:
"pip @ file://localhost/localbuilds/pip-1.3.1-py33-none-any.whl"
"pip @ file:///localbuilds/pip-1.3.1-py33-none-any.whl"
"pip @ /localbuilds/pip-1.3.1-py33-none-any.whl"
"pip @ localbuilds/pip-1.3.1-py33-none-any.whl"
(I have fed them into the "test program" included in PEP 508 that uses Parsley
for parsing. Note that there are several typos in the grammar in the document text)
The following logic may be flawed:
packaging/packaging/requirements.py
Lines 102 to 104 in d2ed39a
if not (parsed_url.scheme and parsed_url.netloc) or ( | |
not parsed_url.scheme and not parsed_url.netloc): | |
raise InvalidRequirement("Invalid URL given") |
jaraco, astrojuanlu and sethmlarson