Skip to content

Commit

Permalink
Merge pull request #850 from ericfrederich/fix-requirements-fixer
Browse files Browse the repository at this point in the history
Stop pkg_resources from being added as well
  • Loading branch information
asottile authored Apr 6, 2024
2 parents 2c9f875 + eadcce2 commit b73acb1
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
5 changes: 4 additions & 1 deletion pre_commit_hooks/requirements_txt_fixer.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,10 @@ def fix_requirements(f: IO[bytes]) -> int:
# which is automatically added by broken pip package under Debian
requirements = [
req for req in requirements
if req.value != b'pkg-resources==0.0.0\n'
if req.value not in [
b'pkg-resources==0.0.0\n',
b'pkg_resources==0.0.0\n',
]
]

# sort the requirements and remove duplicates
Expand Down
2 changes: 2 additions & 0 deletions tests/requirements_txt_fixer_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,8 @@
),
(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'),
(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'),
(
b'git+ssh://git_url@tag#egg=ocflib\nDjango\nijk\n',
FAIL,
Expand Down

0 comments on commit b73acb1

Please sign in to comment.