Skip to content

Commit 86b0779

Browse files
committed
Forbid dependencies direct url
1 parent e8fdd57 commit 86b0779

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

pip/req/req_install.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,11 @@ def from_req(cls, req, comes_from=None, isolated=False, wheel_cache=None):
164164
req = Requirement(req)
165165
except InvalidRequirement:
166166
raise InstallationError("Invalid requirement: '%s'" % req)
167+
if req.url:
168+
raise InstallationError(
169+
"Direct url requirement (like %s) are not allowed for "
170+
"dependencies" % req
171+
)
167172
return cls(req, comes_from, isolated=isolated, wheel_cache=wheel_cache)
168173

169174
@classmethod

tests/functional/test_install.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1217,7 +1217,6 @@ def test_install_pep508_with_url_in_install_requires(script):
12171217
'ce1a869fe039fbf7e217df36c4653d1dbe657778b2d41709593a0003584405f4'
12181218
],
12191219
)
1220-
res = script.pip('install', pkga_path)
1221-
assert "Successfully installed" in str(res), str(res)
1222-
res = script.pip('list', '--format=freeze')
1223-
assert 'packaging==15.3' in res.stdout
1220+
res = script.pip('install', pkga_path, expect_error=True)
1221+
assert "Direct url requirement " in res.stderr, str(res)
1222+
assert "are not allowed for dependencies" in res.stderr, str(res)

0 commit comments

Comments
 (0)