Provide automatic removal of pkg-resources==0.0.0

Should help to deal with that pretty paintuly issue under Ubuntu/Debian
family:
https://bugs.launchpad.net/ubuntu/+source/python-pip/+bug/1635463
This commit is contained in:
Michał Sochoń 2018-03-25 23:28:04 +02:00
parent 1bdd699a79
commit 1d6ad0d6ed
2 changed files with 7 additions and 0 deletions

View file

@ -69,6 +69,11 @@ def fix_requirements(f):
else:
rest = []
for requirement in requirements:
if b'pkg-resources' in requirement.name:
if b'0.0.0' in requirement.value:
requirements.remove(requirement)
for requirement in sorted(requirements):
after.extend(requirement.comments)
after.append(requirement.value)

View file

@ -28,6 +28,8 @@ from pre_commit_hooks.requirements_txt_fixer import Requirement
FAIL,
b'Django\n-e git+ssh://git_url@tag#egg=ocflib\nPyMySQL\n',
),
(b'bar\npkg-resources==0.0.0\nfoo\n', FAIL, b'bar\nfoo\n'),
(b'foo\npkg-resources==0.0.0\nbar\n', FAIL, b'bar\nfoo\n'),
),
)
def test_integration(input_s, expected_retval, output, tmpdir):