Commits

Anonymous committed 16bfa4e

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

Comments (0)

Files changed (2)

             # 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'):

tests/test_uninstall.py

         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