mirror of
https://github.com/pre-commit/pre-commit-hooks.git
synced 2026-04-10 05:14:18 +00:00
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:
parent
1bdd699a79
commit
1d6ad0d6ed
2 changed files with 7 additions and 0 deletions
|
|
@ -69,6 +69,11 @@ def fix_requirements(f):
|
||||||
else:
|
else:
|
||||||
rest = []
|
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):
|
for requirement in sorted(requirements):
|
||||||
after.extend(requirement.comments)
|
after.extend(requirement.comments)
|
||||||
after.append(requirement.value)
|
after.append(requirement.value)
|
||||||
|
|
|
||||||
|
|
@ -28,6 +28,8 @@ from pre_commit_hooks.requirements_txt_fixer import Requirement
|
||||||
FAIL,
|
FAIL,
|
||||||
b'Django\n-e git+ssh://git_url@tag#egg=ocflib\nPyMySQL\n',
|
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):
|
def test_integration(input_s, expected_retval, output, tmpdir):
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue