-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcommit-msg
More file actions
executable file
·29 lines (27 loc) · 917 Bytes
/
Copy pathcommit-msg
File metadata and controls
executable file
·29 lines (27 loc) · 917 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#!/usr/bin/env bash
me=$(basename "$0")
case "$OSTYPE" in
msys*|mingw*|cygwin*|win32*)
echo "Running ${me} on Windows"
if command -v python3 >/dev/null 2>&1 && python3 -c "import sys" >/dev/null 2>&1; then
PYTHON_EXECUTABLE=(python3)
elif command -v python >/dev/null 2>&1 && python -c "import sys" >/dev/null 2>&1; then
PYTHON_EXECUTABLE=(python)
else
echo "Error: Python not found or not runnable"
exit 1
fi
;;
*)
echo "Running ${me} on linux / mac / unix"
if command -v python3 >/dev/null 2>&1 && python3 -c "import sys" >/dev/null 2>&1; then
PYTHON_EXECUTABLE=(python3)
elif command -v python >/dev/null 2>&1 && python -c "import sys" >/dev/null 2>&1; then
PYTHON_EXECUTABLE=(python)
else
echo "Error: Python not found or not runnable"
exit 1
fi
;;
esac
"${PYTHON_EXECUTABLE[@]}" "${BASH_SOURCE[0]%.*}.py" "$@"