From db01fc94822f8a9921ebe90fb5864021881916c9 Mon Sep 17 00:00:00 2001 From: Manish Maharjan Date: Thu, 30 Apr 2026 23:50:55 +0100 Subject: [PATCH 1/3] SYS-8273 confirm a real interpreter is being used instead of microsoft store alias --- main/commit-msg | 14 ++++++++++---- main/pre-commit | 14 ++++++++++---- main/pre-merge-commit | 14 ++++++++++---- 3 files changed, 30 insertions(+), 12 deletions(-) diff --git a/main/commit-msg b/main/commit-msg index 98190eb..50550eb 100755 --- a/main/commit-msg +++ b/main/commit-msg @@ -1,12 +1,18 @@ #!/usr/bin/env bash me=$(basename "$0") +is_python3() { + "$1" -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 + 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 py >/dev/null 2>&1 && py -3 -c 'import sys; sys.exit(0 if sys.version_info[0] == 3 else 1)' >/dev/null 2>&1; then + PYTHON_EXECUTABLE=(py -3) + elif command -v python >/dev/null 2>&1 && is_python3 python; then PYTHON_EXECUTABLE=(python) else echo "Error: Python not found or not runnable" @@ -15,9 +21,9 @@ case "$OSTYPE" in ;; *) 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" diff --git a/main/pre-commit b/main/pre-commit index 98190eb..50550eb 100755 --- a/main/pre-commit +++ b/main/pre-commit @@ -1,12 +1,18 @@ #!/usr/bin/env bash me=$(basename "$0") +is_python3() { + "$1" -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 + 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 py >/dev/null 2>&1 && py -3 -c 'import sys; sys.exit(0 if sys.version_info[0] == 3 else 1)' >/dev/null 2>&1; then + PYTHON_EXECUTABLE=(py -3) + elif command -v python >/dev/null 2>&1 && is_python3 python; then PYTHON_EXECUTABLE=(python) else echo "Error: Python not found or not runnable" @@ -15,9 +21,9 @@ case "$OSTYPE" in ;; *) 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" diff --git a/main/pre-merge-commit b/main/pre-merge-commit index 98190eb..50550eb 100755 --- a/main/pre-merge-commit +++ b/main/pre-merge-commit @@ -1,12 +1,18 @@ #!/usr/bin/env bash me=$(basename "$0") +is_python3() { + "$1" -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 + 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 py >/dev/null 2>&1 && py -3 -c 'import sys; sys.exit(0 if sys.version_info[0] == 3 else 1)' >/dev/null 2>&1; then + PYTHON_EXECUTABLE=(py -3) + elif command -v python >/dev/null 2>&1 && is_python3 python; then PYTHON_EXECUTABLE=(python) else echo "Error: Python not found or not runnable" @@ -15,9 +21,9 @@ case "$OSTYPE" in ;; *) 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" From 6ad140153e37b2d2024085145aea09e1aa3baa43 Mon Sep 17 00:00:00 2001 From: Manish Maharjan Date: Thu, 30 Apr 2026 23:59:33 +0100 Subject: [PATCH 2/3] SYS-8273 space syntax --- main/commit-msg | 10 +++++----- main/pre-commit | 10 +++++----- main/pre-merge-commit | 10 +++++----- 3 files changed, 15 insertions(+), 15 deletions(-) diff --git a/main/commit-msg b/main/commit-msg index 50550eb..f1b968c 100755 --- a/main/commit-msg +++ b/main/commit-msg @@ -8,11 +8,11 @@ is_python3() { case "$OSTYPE" in msys*|mingw*|cygwin*|win32*) echo "Running ${me} on Windows" - if command -v python3 >/dev/null 2>&1 && is_python3 python3; then + if command -v python3 > /dev/null 2>&1 && is_python3 python3; then PYTHON_EXECUTABLE=(python3) - elif command -v py >/dev/null 2>&1 && py -3 -c 'import sys; sys.exit(0 if sys.version_info[0] == 3 else 1)' >/dev/null 2>&1; then + elif command -v py > /dev/null 2>&1 && py -3 -c 'import sys; sys.exit(0 if sys.version_info[0] == 3 else 1)' > /dev/null 2>&1; then PYTHON_EXECUTABLE=(py -3) - elif command -v python >/dev/null 2>&1 && is_python3 python; 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" @@ -21,9 +21,9 @@ case "$OSTYPE" in ;; *) echo "Running ${me} on linux / mac / unix" - if command -v python3 >/dev/null 2>&1 && is_python3 python3; then + if command -v python3 > /dev/null 2>&1 && is_python3 python3; then PYTHON_EXECUTABLE=(python3) - elif command -v python >/dev/null 2>&1 && is_python3 python; 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" diff --git a/main/pre-commit b/main/pre-commit index 50550eb..f1b968c 100755 --- a/main/pre-commit +++ b/main/pre-commit @@ -8,11 +8,11 @@ is_python3() { case "$OSTYPE" in msys*|mingw*|cygwin*|win32*) echo "Running ${me} on Windows" - if command -v python3 >/dev/null 2>&1 && is_python3 python3; then + if command -v python3 > /dev/null 2>&1 && is_python3 python3; then PYTHON_EXECUTABLE=(python3) - elif command -v py >/dev/null 2>&1 && py -3 -c 'import sys; sys.exit(0 if sys.version_info[0] == 3 else 1)' >/dev/null 2>&1; then + elif command -v py > /dev/null 2>&1 && py -3 -c 'import sys; sys.exit(0 if sys.version_info[0] == 3 else 1)' > /dev/null 2>&1; then PYTHON_EXECUTABLE=(py -3) - elif command -v python >/dev/null 2>&1 && is_python3 python; 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" @@ -21,9 +21,9 @@ case "$OSTYPE" in ;; *) echo "Running ${me} on linux / mac / unix" - if command -v python3 >/dev/null 2>&1 && is_python3 python3; then + if command -v python3 > /dev/null 2>&1 && is_python3 python3; then PYTHON_EXECUTABLE=(python3) - elif command -v python >/dev/null 2>&1 && is_python3 python; 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" diff --git a/main/pre-merge-commit b/main/pre-merge-commit index 50550eb..f1b968c 100755 --- a/main/pre-merge-commit +++ b/main/pre-merge-commit @@ -8,11 +8,11 @@ is_python3() { case "$OSTYPE" in msys*|mingw*|cygwin*|win32*) echo "Running ${me} on Windows" - if command -v python3 >/dev/null 2>&1 && is_python3 python3; then + if command -v python3 > /dev/null 2>&1 && is_python3 python3; then PYTHON_EXECUTABLE=(python3) - elif command -v py >/dev/null 2>&1 && py -3 -c 'import sys; sys.exit(0 if sys.version_info[0] == 3 else 1)' >/dev/null 2>&1; then + elif command -v py > /dev/null 2>&1 && py -3 -c 'import sys; sys.exit(0 if sys.version_info[0] == 3 else 1)' > /dev/null 2>&1; then PYTHON_EXECUTABLE=(py -3) - elif command -v python >/dev/null 2>&1 && is_python3 python; 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" @@ -21,9 +21,9 @@ case "$OSTYPE" in ;; *) echo "Running ${me} on linux / mac / unix" - if command -v python3 >/dev/null 2>&1 && is_python3 python3; then + if command -v python3 > /dev/null 2>&1 && is_python3 python3; then PYTHON_EXECUTABLE=(python3) - elif command -v python >/dev/null 2>&1 && is_python3 python; 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" From 7ec79a1e79e19cb3f1b3743af5a9d2b9a4c56515 Mon Sep 17 00:00:00 2001 From: Manish Maharjan Date: Fri, 1 May 2026 00:49:50 +0100 Subject: [PATCH 3/3] SYS-8273 py -3 pushed to top --- main/commit-msg | 23 +++++++++++++---------- main/pre-commit | 23 +++++++++++++---------- main/pre-merge-commit | 23 +++++++++++++---------- 3 files changed, 39 insertions(+), 30 deletions(-) diff --git a/main/commit-msg b/main/commit-msg index f1b968c..ebdc690 100755 --- a/main/commit-msg +++ b/main/commit-msg @@ -2,28 +2,31 @@ me=$(basename "$0") is_python3() { - "$1" -c 'import sys; sys.exit(0 if sys.version_info[0] == 3 else 1)' >/dev/null 2>&1 + "$@" -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 && is_python3 python3; then - PYTHON_EXECUTABLE=(python3) - elif command -v py > /dev/null 2>&1 && py -3 -c 'import sys; sys.exit(0 if sys.version_info[0] == 3 else 1)' > /dev/null 2>&1; then + if command -v py >/dev/null 2>&1 && is_python3 py -3; then PYTHON_EXECUTABLE=(py -3) - elif command -v python > /dev/null 2>&1 && is_python3 python; then - PYTHON_EXECUTABLE=(python) 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 && is_python3 python3; then + if command -v python3 >/dev/null 2>&1 && is_python3 python3; then PYTHON_EXECUTABLE=(python3) - elif command -v python > /dev/null 2>&1 && is_python3 python; 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" diff --git a/main/pre-commit b/main/pre-commit index f1b968c..ebdc690 100755 --- a/main/pre-commit +++ b/main/pre-commit @@ -2,28 +2,31 @@ me=$(basename "$0") is_python3() { - "$1" -c 'import sys; sys.exit(0 if sys.version_info[0] == 3 else 1)' >/dev/null 2>&1 + "$@" -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 && is_python3 python3; then - PYTHON_EXECUTABLE=(python3) - elif command -v py > /dev/null 2>&1 && py -3 -c 'import sys; sys.exit(0 if sys.version_info[0] == 3 else 1)' > /dev/null 2>&1; then + if command -v py >/dev/null 2>&1 && is_python3 py -3; then PYTHON_EXECUTABLE=(py -3) - elif command -v python > /dev/null 2>&1 && is_python3 python; then - PYTHON_EXECUTABLE=(python) 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 && is_python3 python3; then + if command -v python3 >/dev/null 2>&1 && is_python3 python3; then PYTHON_EXECUTABLE=(python3) - elif command -v python > /dev/null 2>&1 && is_python3 python; 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" diff --git a/main/pre-merge-commit b/main/pre-merge-commit index f1b968c..ebdc690 100755 --- a/main/pre-merge-commit +++ b/main/pre-merge-commit @@ -2,28 +2,31 @@ me=$(basename "$0") is_python3() { - "$1" -c 'import sys; sys.exit(0 if sys.version_info[0] == 3 else 1)' >/dev/null 2>&1 + "$@" -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 && is_python3 python3; then - PYTHON_EXECUTABLE=(python3) - elif command -v py > /dev/null 2>&1 && py -3 -c 'import sys; sys.exit(0 if sys.version_info[0] == 3 else 1)' > /dev/null 2>&1; then + if command -v py >/dev/null 2>&1 && is_python3 py -3; then PYTHON_EXECUTABLE=(py -3) - elif command -v python > /dev/null 2>&1 && is_python3 python; then - PYTHON_EXECUTABLE=(python) 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 && is_python3 python3; then + if command -v python3 >/dev/null 2>&1 && is_python3 python3; then PYTHON_EXECUTABLE=(python3) - elif command -v python > /dev/null 2>&1 && is_python3 python; 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"