Skip to content

Commit

Permalink
Fix: Change pre-commit shebang line when using poetry (#381)
Browse files Browse the repository at this point in the history
  • Loading branch information
kidylee authored Oct 10, 2022
1 parent 8de747e commit e851c7d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions autohooks/template.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@

PYTHON3_SHEBANG = "/usr/bin/env python3"
PIPENV_SHEBANG = "/usr/bin/env -S pipenv run python3"
POETRY_SHEBANG = "/usr/bin/env -S poetry run python3"
POETRY_SHEBANG = "/usr/bin/env -S poetry run python"
# For OS's that don't support '/usr/bin/env -S'.
PIPENV_MULTILINE_SHEBANG = (
"/bin/sh\n"
Expand All @@ -35,7 +35,7 @@
POETRY_MULTILINE_SHEBANG = (
"/bin/sh\n"
"\"true\" ''':'\n"
'poetry run python3 "$0" "$@"\n'
'poetry run python "$0" "$@"\n'
'exit "$?"\n'
"'''"
)
Expand Down
4 changes: 2 additions & 2 deletions tests/test_template.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ def test_should_render_mode_poetry(self):
template = PreCommitTemplate(path)
self.assertEqual(
template.render(mode=Mode.POETRY),
"/usr/bin/env -S poetry run python3",
"/usr/bin/env -S poetry run python",
)

def test_should_render_mode_pipenv_multiline(self):
Expand All @@ -94,7 +94,7 @@ def test_should_render_mode_poetry_multiline(self):
(
"/bin/sh\n"
"\"true\" ''':'\n"
'poetry run python3 "$0" "$@"\n'
'poetry run python "$0" "$@"\n'
'exit "$?"\n'
"'''"
),
Expand Down

0 comments on commit e851c7d

Please sign in to comment.