mirror of
https://github.com/pre-commit/pre-commit-hooks.git
synced 2026-03-31 10:36:54 +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:
|
||||
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)
|
||||
|
|
|
|||
|
|
@ -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):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue