Skip to content

Commit

Permalink
Forbid dependencies direct url
Browse files Browse the repository at this point in the history
  • Loading branch information
xavfernandez committed Jan 30, 2017
1 parent e8fdd57 commit 86b0779
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
5 changes: 5 additions & 0 deletions pip/req/req_install.py
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,11 @@ def from_req(cls, req, comes_from=None, isolated=False, wheel_cache=None):
req = Requirement(req)
except InvalidRequirement:
raise InstallationError("Invalid requirement: '%s'" % req)
if req.url:
raise InstallationError(
"Direct url requirement (like %s) are not allowed for "
"dependencies" % req
)
return cls(req, comes_from, isolated=isolated, wheel_cache=wheel_cache)

@classmethod
Expand Down
7 changes: 3 additions & 4 deletions tests/functional/test_install.py
Original file line number Diff line number Diff line change
Expand Up @@ -1217,7 +1217,6 @@ def test_install_pep508_with_url_in_install_requires(script):
'ce1a869fe039fbf7e217df36c4653d1dbe657778b2d41709593a0003584405f4'
],
)
res = script.pip('install', pkga_path)
assert "Successfully installed" in str(res), str(res)
res = script.pip('list', '--format=freeze')
assert 'packaging==15.3' in res.stdout
res = script.pip('install', pkga_path, expect_error=True)
assert "Direct url requirement " in res.stderr, str(res)
assert "are not allowed for dependencies" in res.stderr, str(res)

0 comments on commit 86b0779

Please sign in to comment.