Skip to content

Commit 5178654

Browse files
authoredFeb 3, 2022
Fix Windows support by handling sh shebangs from pre-commit (#1121)
* fix Windows support by handling sh shebangs from pre-commit * More specific pattern to detect sh shell
1 parent d40ac32 commit 5178654

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed
 

‎{{cookiecutter.project_name}}/noxfile.py

+5
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,11 @@ def activate_virtualenv_in_precommit_hooks(session: Session) -> None:
7575
VIRTUAL_ENV={shlex.quote(virtualenv)}
7676
PATH={shlex.quote(session.bin)}"{os.pathsep}$PATH"
7777
""",
78+
# pre-commit >= 2.17.0 on Windows forces sh shebang
79+
"/bin/sh": f"""\
80+
VIRTUAL_ENV={shlex.quote(virtualenv)}
81+
PATH={shlex.quote(session.bin)}"{os.pathsep}$PATH"
82+
""",
7883
}
7984

8085
hookdir = Path(".git") / "hooks"

0 commit comments

Comments
 (0)
Please sign in to comment.