Skip to content

Commit eadcce2

Browse files
committed
Stop pkg_resources from being added as well
This package with an underscore instead of a dash seems to be new behavior (at least on Ubuntu 20.04 with Python 3.8) fixes #1030
1 parent 6afc574 commit eadcce2

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

pre_commit_hooks/requirements_txt_fixer.py

+4-1
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,10 @@ def fix_requirements(f: IO[bytes]) -> int:
115115
# which is automatically added by broken pip package under Debian
116116
requirements = [
117117
req for req in requirements
118-
if req.value != b'pkg-resources==0.0.0\n'
118+
if req.value not in [
119+
b'pkg-resources==0.0.0\n',
120+
b'pkg_resources==0.0.0\n',
121+
]
119122
]
120123

121124
# sort the requirements and remove duplicates

tests/requirements_txt_fixer_test.py

+2
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,8 @@
8282
),
8383
(b'bar\npkg-resources==0.0.0\nfoo\n', FAIL, b'bar\nfoo\n'),
8484
(b'foo\npkg-resources==0.0.0\nbar\n', FAIL, b'bar\nfoo\n'),
85+
(b'bar\npkg_resources==0.0.0\nfoo\n', FAIL, b'bar\nfoo\n'),
86+
(b'foo\npkg_resources==0.0.0\nbar\n', FAIL, b'bar\nfoo\n'),
8587
(
8688
b'git+ssh://git_url@tag#egg=ocflib\nDjango\nijk\n',
8789
FAIL,

0 commit comments

Comments
 (0)