mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-25 03:01:03 +00:00
git-hooks: Not all OSes ship Python 3 under "python"
macOS doesn't, for instance. Use a shell script to detect which python to run, which is always available on all OSes due to how git is packaged on Windows. Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5060>
This commit is contained in:
parent
5943f9d669
commit
fcf590a86e
3 changed files with 14 additions and 2 deletions
|
@ -15,7 +15,7 @@
|
||||||
# commit. They are executed in the order in which they are listed.
|
# commit. They are executed in the order in which they are listed.
|
||||||
###########################################################
|
###########################################################
|
||||||
|
|
||||||
HOOKS="scripts/git-hooks/pre-commit.hook scripts/git-hooks/pre-commit-python.hook"
|
HOOKS="scripts/git-hooks/pre-commit.hook scripts/git-hooks/pre-commit-invoke-python.hook"
|
||||||
|
|
||||||
# exit on error
|
# exit on error
|
||||||
set -e
|
set -e
|
||||||
|
|
12
scripts/git-hooks/pre-commit-invoke-python.hook
Executable file
12
scripts/git-hooks/pre-commit-invoke-python.hook
Executable file
|
@ -0,0 +1,12 @@
|
||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
PYTHON="python3"
|
||||||
|
if [[ $OS =~ Windows ]]; then
|
||||||
|
if type -p py &>/dev/null; then
|
||||||
|
PYTHON="py -3"
|
||||||
|
elif type -p python &>/dev/null; then
|
||||||
|
PYTHON="python"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
$PYTHON "`dirname $0`/pre-commit-python.hook"
|
|
@ -1,4 +1,4 @@
|
||||||
#!/usr/bin/env python
|
#!/usr/bin/env python3
|
||||||
import os
|
import os
|
||||||
import subprocess
|
import subprocess
|
||||||
import sys
|
import sys
|
||||||
|
|
Loading…
Reference in a new issue