Skip to content

Commit b73acb1

Browse files
authored
Merge pull request #850 from ericfrederich/fix-requirements-fixer
Stop pkg_resources from being added as well
2 parents 2c9f875 + eadcce2 commit b73acb1

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)