Commit bc4193b1 authored by Ben Nemec's avatar Ben Nemec Committed by Stephen Finucane

Ignore --find-links in requirements file

We already skip things like --index-url, but --find-links can also
be present and also shouldn't be included in install_requires.

This also fixes some issues with the existing unit test for this

Change-Id: Ie8eca8c19e955d52722feaa71d5843ccd74b0da0
Closes-Bug: 1716808
parent d01abc82
......@@ -116,7 +116,8 @@ def parse_requirements(requirements_files=None, strip_markers=False):
# Ignore index URL lines
if re.match(r'^\s*(-i|--index-url|--extra-index-url).*', line):
if re.match(r'^\s*(-i|--index-url|--extra-index-url|--find-links).*',
# Handle nested requirements files such as:
......@@ -532,11 +532,13 @@ class ParseRequirementsTest(base.BaseTestCase):
tempdir = tempfile.mkdtemp()
requirements = os.path.join(tempdir, 'requirements.txt')
with open(requirements, 'w') as f:
f.write('-i https://myindex.local')
f.write(' --index-url https://myindex.local')
f.write(' --extra-index-url https://myindex.local')
f.write('-i https://myindex.local\n')
f.write(' --index-url https://myindex.local\n')
f.write(' --extra-index-url https://myindex.local\n')
f.write('--find-links https://myindex.local\n')
result = packaging.parse_requirements([requirements])
self.assertEqual([], result)
self.assertEqual(['arequirement>=1.0'], result)
def test_nested_requirements(self):
tempdir = tempfile.mkdtemp()
- |
PBR now ignores ``--find-links`` in requirements files. This option is not
a valid ``install_requires`` entry for setuptools and thus breaks
PBR-based installs.
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