Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 17 additions & 8 deletions main/commit-msg
Original file line number Diff line number Diff line change
@@ -1,23 +1,32 @@
#!/usr/bin/env bash
me=$(basename "$0")

is_python3() {
"$@" -c 'import sys; sys.exit(0 if sys.version_info[0] == 3 else 1)' >/dev/null 2>&1
}

case "$OSTYPE" in
msys*|mingw*|cygwin*|win32*)
echo "Running ${me} on Windows"
if command -v python3 > /dev/null 2>&1; then
PYTHON_EXECUTABLE=(python3)
elif command -v python > /dev/null 2>&1; then
PYTHON_EXECUTABLE=(python)
if command -v py >/dev/null 2>&1 && is_python3 py -3; then
PYTHON_EXECUTABLE=(py -3)
else
echo "Error: Python not found or not runnable"
exit 1
python3_path=$(command -v python3 2>/dev/null || true)
if [ -n "$python3_path" ] && [[ "$python3_path" != *WindowsApps* ]] && is_python3 python3; then
PYTHON_EXECUTABLE=(python3)
elif command -v python >/dev/null 2>&1 && is_python3 python; then
PYTHON_EXECUTABLE=(python)
else
echo "Error: Python 3 not found. Please install Python 3 or disable the Microsoft Store python alias."
exit 1
fi
fi
;;
*)
echo "Running ${me} on linux / mac / unix"
if command -v python3 > /dev/null 2>&1; then
if command -v python3 >/dev/null 2>&1 && is_python3 python3; then
PYTHON_EXECUTABLE=(python3)
elif command -v python > /dev/null 2>&1; then
elif command -v python >/dev/null 2>&1 && is_python3 python; then
PYTHON_EXECUTABLE=(python)
else
echo "Error: Python not found or not runnable"
Expand Down
25 changes: 17 additions & 8 deletions main/pre-commit
Original file line number Diff line number Diff line change
@@ -1,23 +1,32 @@
#!/usr/bin/env bash
me=$(basename "$0")

is_python3() {
"$@" -c 'import sys; sys.exit(0 if sys.version_info[0] == 3 else 1)' >/dev/null 2>&1
}

case "$OSTYPE" in
msys*|mingw*|cygwin*|win32*)
echo "Running ${me} on Windows"
if command -v python3 > /dev/null 2>&1; then
PYTHON_EXECUTABLE=(python3)
elif command -v python > /dev/null 2>&1; then
PYTHON_EXECUTABLE=(python)
if command -v py >/dev/null 2>&1 && is_python3 py -3; then
PYTHON_EXECUTABLE=(py -3)
else
echo "Error: Python not found or not runnable"
exit 1
python3_path=$(command -v python3 2>/dev/null || true)
if [ -n "$python3_path" ] && [[ "$python3_path" != *WindowsApps* ]] && is_python3 python3; then
PYTHON_EXECUTABLE=(python3)
elif command -v python >/dev/null 2>&1 && is_python3 python; then
PYTHON_EXECUTABLE=(python)
else
echo "Error: Python 3 not found. Please install Python 3 or disable the Microsoft Store python alias."
exit 1
fi
fi
;;
*)
echo "Running ${me} on linux / mac / unix"
if command -v python3 > /dev/null 2>&1; then
if command -v python3 >/dev/null 2>&1 && is_python3 python3; then
PYTHON_EXECUTABLE=(python3)
elif command -v python > /dev/null 2>&1; then
elif command -v python >/dev/null 2>&1 && is_python3 python; then
PYTHON_EXECUTABLE=(python)
else
echo "Error: Python not found or not runnable"
Expand Down
25 changes: 17 additions & 8 deletions main/pre-merge-commit
Original file line number Diff line number Diff line change
@@ -1,23 +1,32 @@
#!/usr/bin/env bash
me=$(basename "$0")

is_python3() {
"$@" -c 'import sys; sys.exit(0 if sys.version_info[0] == 3 else 1)' >/dev/null 2>&1
}

case "$OSTYPE" in
msys*|mingw*|cygwin*|win32*)
echo "Running ${me} on Windows"
if command -v python3 > /dev/null 2>&1; then
PYTHON_EXECUTABLE=(python3)
elif command -v python > /dev/null 2>&1; then
PYTHON_EXECUTABLE=(python)
if command -v py >/dev/null 2>&1 && is_python3 py -3; then
PYTHON_EXECUTABLE=(py -3)
else
echo "Error: Python not found or not runnable"
exit 1
python3_path=$(command -v python3 2>/dev/null || true)
if [ -n "$python3_path" ] && [[ "$python3_path" != *WindowsApps* ]] && is_python3 python3; then
PYTHON_EXECUTABLE=(python3)
elif command -v python >/dev/null 2>&1 && is_python3 python; then
PYTHON_EXECUTABLE=(python)
else
echo "Error: Python 3 not found. Please install Python 3 or disable the Microsoft Store python alias."
exit 1
fi
fi
;;
*)
echo "Running ${me} on linux / mac / unix"
if command -v python3 > /dev/null 2>&1; then
if command -v python3 >/dev/null 2>&1 && is_python3 python3; then
PYTHON_EXECUTABLE=(python3)
elif command -v python > /dev/null 2>&1; then
elif command -v python >/dev/null 2>&1 && is_python3 python; then
PYTHON_EXECUTABLE=(python)
else
echo "Error: Python not found or not runnable"
Expand Down