提交 c6aa0bd4 编写于 作者: C Carl Meyer

ignore -f, -i, etc when uninstalling from reqs file

上级 c8798a28
......@@ -1345,23 +1345,23 @@ def parse_requirements(filename, finder=None, comes_from=None, options=None):
# No longer used, but previously these were used in
# requirement files, so we'll ignore.
pass
elif finder and line.startswith('-f') or line.startswith('--find-links'):
elif line.startswith('-f') or line.startswith('--find-links'):
if line.startswith('-f'):
line = line[2:].strip()
else:
line = line[len('--find-links'):].strip().lstrip('=')
## FIXME: it would be nice to keep track of the source of
## the find_links:
finder.find_links.append(line)
if finder: finder.find_links.append(line)
elif line.startswith('-i') or line.startswith('--index-url'):
if line.startswith('-i'):
line = line[2:].strip()
else:
line = line[len('--index-url'):].strip().lstrip('=')
finder.index_urls = [line]
if finder: finder.index_urls = [line]
elif line.startswith('--extra-index-url'):
line = line[len('--extra-index-url'):].strip().lstrip('=')
finder.index_urls.append(line)
if finder: finder.index_urls.append(line)
else:
comes_from = '-r %s (line %s)' % (filename, line_number)
if line.startswith('-e') or line.startswith('--editable'):
......
......@@ -115,7 +115,17 @@ def test_uninstall_from_reqs_file():
PyLogo<0.4
"""))
result = run_pip('install', '-r', 'test-req.txt')
write_file('test-req.txt', textwrap.dedent("""\
# -f, -i, and --extra-index-url should all be ignored by uninstall
-f http://www.example.com
-i http://www.example.com
--extra-index-url http://www.example.com
-e svn+http://svn.colorstudy.com/INITools/trunk#egg=initools-dev
# and something else to test out:
PyLogo<0.4
"""))
result2 = run_pip('uninstall', '-r', 'test-req.txt', '-y')
diff = diff_states(result.files_before, result2.files_after, ignore=['build', 'src']).values()
diff = diff_states(result.files_before, result2.files_after, ignore=['build', 'src', 'test-req.txt']).values()
assert diff == [{}, {}, {}], diff
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册