mirror of
https://github.com/pre-commit/pre-commit.git
synced 2026-02-17 00:04:42 +04:00
always use #!/bin/sh on windows
This commit is contained in:
parent
cccbc9d280
commit
e3dc3f7934
2 changed files with 8 additions and 1 deletions
|
|
@ -82,6 +82,13 @@ def _install_hook_script(
|
||||||
before, rest = contents.split(TEMPLATE_START)
|
before, rest = contents.split(TEMPLATE_START)
|
||||||
_, after = rest.split(TEMPLATE_END)
|
_, after = rest.split(TEMPLATE_END)
|
||||||
|
|
||||||
|
# on windows always use `/bin/sh` since `bash` might not be on PATH
|
||||||
|
# though we use bash-specific features `sh` on windows is actually
|
||||||
|
# bash in "POSIXLY_CORRECT" mode which still supports the features we
|
||||||
|
# use: subshells / arrays
|
||||||
|
if sys.platform == 'win32': # pragma: win32 cover
|
||||||
|
hook_file.write('#!/bin/sh\n')
|
||||||
|
|
||||||
hook_file.write(before + TEMPLATE_START)
|
hook_file.write(before + TEMPLATE_START)
|
||||||
hook_file.write(f'INSTALL_PYTHON={shlex.quote(sys.executable)}\n')
|
hook_file.write(f'INSTALL_PYTHON={shlex.quote(sys.executable)}\n')
|
||||||
# TODO: python3.8+: shlex.join
|
# TODO: python3.8+: shlex.join
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
covdefaults>=2.1
|
covdefaults>=2.2
|
||||||
coverage
|
coverage
|
||||||
distlib
|
distlib
|
||||||
pytest
|
pytest
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue