Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
29 changes: 20 additions & 9 deletions main/commit-msg
Original file line number Diff line number Diff line change
@@ -1,18 +1,29 @@
#!/usr/bin/env bash
me=`basename "$0"`
me=$(basename "$0")

case "$OSTYPE" in
msys)
echo "Running ${me} in MinGW"
PYTHON_EXECUTABLE=python
;;
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
;;
Comment thread
mmaharjan-ccdc marked this conversation as resolved.
*)
echo "Running ${me} on linux / mac / unix"
if command -v python3 > /dev/null 2>&1; then
PYTHON_EXECUTABLE=python3
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)
Comment thread
mmaharjan-ccdc marked this conversation as resolved.
Outdated
else
PYTHON_EXECUTABLE=python
echo "Error: Python not found or not runnable"
exit 1
fi
;;
esac

${PYTHON_EXECUTABLE} "${BASH_SOURCE[0]%.*}.py" "$@"
"${PYTHON_EXECUTABLE[@]}" "${BASH_SOURCE[0]%.*}.py" "$@"
29 changes: 20 additions & 9 deletions main/pre-commit
Original file line number Diff line number Diff line change
@@ -1,18 +1,29 @@
#!/usr/bin/env bash
me=`basename "$0"`
me=$(basename "$0")

case "$OSTYPE" in
msys)
echo "Running ${me} in MinGW"
PYTHON_EXECUTABLE=python
;;
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
;;
Comment thread
mmaharjan-ccdc marked this conversation as resolved.
*)
echo "Running ${me} on linux / mac / unix"
if command -v python3 > /dev/null 2>&1; then
PYTHON_EXECUTABLE=python3
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)
Comment thread
mmaharjan-ccdc marked this conversation as resolved.
Outdated
else
PYTHON_EXECUTABLE=python
echo "Error: Python not found or not runnable"
exit 1
fi
;;
esac

${PYTHON_EXECUTABLE} "${BASH_SOURCE[0]%.*}.py" "$@"
"${PYTHON_EXECUTABLE[@]}" "${BASH_SOURCE[0]%.*}.py" "$@"
31 changes: 21 additions & 10 deletions main/pre-merge-commit
Original file line number Diff line number Diff line change
@@ -1,18 +1,29 @@
#!/usr/bin/env bash
me=`basename "$0"`
me=$(basename "$0")

case "$OSTYPE" in
msys)
echo "Running ${me} in MinGW"
PYTHON_EXECUTABLE=python
;;
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
;;
Comment thread
mmaharjan-ccdc marked this conversation as resolved.
*)
echo "Running ${me} linux / mac / unix"
if command -v python3 > /dev/null 2>&1; then
PYTHON_EXECUTABLE=python3
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)
Comment thread
mmaharjan-ccdc marked this conversation as resolved.
Outdated
else
PYTHON_EXECUTABLE=python
echo "Error: Python not found or not runnable"
exit 1
fi
;;
esac

${PYTHON_EXECUTABLE} "${BASH_SOURCE[0]%.*}.py" "$@"
"${PYTHON_EXECUTABLE[@]}" "${BASH_SOURCE[0]%.*}.py" "$@"
Loading