pre-commit: Workaround broken shebang on Windows
Using "python" in the shebang breaks those scripts when ran outside of pre-commit venv. Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/9080>
This commit is contained in:
parent
7fe08e057c
commit
cedeef3cb1
@ -1,3 +1,10 @@
|
|||||||
|
# Notes:
|
||||||
|
# - Python commands must be prefixed with `python` because pre-commit refuses to
|
||||||
|
# special-case shebangs on Windows where `python3` does not commonly exists.
|
||||||
|
# Luckily, the `python` command exists in the virtualenv created by pre-commit
|
||||||
|
# on all platforms. https://github.com/pre-commit/pre-commit/issues/3415,
|
||||||
|
# https://github.com/pre-commit/pre-commit/issues/3468
|
||||||
|
|
||||||
fail_fast: false
|
fail_fast: false
|
||||||
repos:
|
repos:
|
||||||
- repo: https://github.com/jorisroovers/gitlint
|
- repo: https://github.com/jorisroovers/gitlint
|
||||||
@ -16,7 +23,7 @@ repos:
|
|||||||
- id: gst-indent
|
- id: gst-indent
|
||||||
name: gst-indent
|
name: gst-indent
|
||||||
language: python
|
language: python
|
||||||
entry: ./scripts/gst-indent-all.py
|
entry: python ./scripts/gst-indent-all.py
|
||||||
pass_filenames: false
|
pass_filenames: false
|
||||||
types_or: ["c", "c++"]
|
types_or: ["c", "c++"]
|
||||||
additional_dependencies: ["gst-indent==1.0.0"]
|
additional_dependencies: ["gst-indent==1.0.0"]
|
||||||
@ -30,6 +37,6 @@ repos:
|
|||||||
- id: doc-checks
|
- id: doc-checks
|
||||||
name: doc-checks
|
name: doc-checks
|
||||||
language: python
|
language: python
|
||||||
entry: ./scripts/git-hooks/pre-commit-python.hook
|
entry: python ./scripts/git-hooks/pre-commit-python.hook
|
||||||
pass_filenames: false
|
pass_filenames: false
|
||||||
additional_dependencies: ["autopep8==2.3.2", "pycodestyle==2.12.1"]
|
additional_dependencies: ["autopep8==2.3.2", "pycodestyle==2.12.1"]
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
#!/usr/bin/env python
|
#!/usr/bin/env python3
|
||||||
|
|
||||||
from itertools import filterfalse
|
from itertools import filterfalse
|
||||||
import os
|
import os
|
||||||
@ -6,6 +6,7 @@ import re
|
|||||||
import subprocess
|
import subprocess
|
||||||
from gst_indent_common import indent
|
from gst_indent_common import indent
|
||||||
|
|
||||||
|
|
||||||
def readfile(f):
|
def readfile(f):
|
||||||
if os.path.exists(f):
|
if os.path.exists(f):
|
||||||
expressions = open(f, 'r', encoding='utf-8').read().splitlines()
|
expressions = open(f, 'r', encoding='utf-8').read().splitlines()
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
#!/usr/bin/env python
|
#!/usr/bin/env python3
|
||||||
|
|
||||||
from sys import argv
|
from sys import argv
|
||||||
from gst_indent_common import indent
|
from gst_indent_common import indent
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
indent(argv[1:])
|
indent(*argv[1:])
|
||||||
|
Loading…
x
Reference in New Issue
Block a user