File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11#! /usr/bin/env bash
22me=$( basename " $0 " )
33
4+ is_python3 () {
5+ " $1 " -c ' import sys; sys.exit(0 if sys.version_info[0] == 3 else 1)' > /dev/null 2>&1
6+ }
7+
48case " $OSTYPE " in
59 msys* |mingw* |cygwin* |win32* )
610 echo " Running ${me} on Windows"
7- if command -v python3 > /dev/null 2>&1 ; then
11+ if command -v python3 > /dev/null 2>&1 && is_python3 python3 ; then
812 PYTHON_EXECUTABLE=(python3)
9- elif command -v python > /dev/null 2>&1 ; then
13+ 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
14+ PYTHON_EXECUTABLE=(py -3)
15+ elif command -v python > /dev/null 2>&1 && is_python3 python; then
1016 PYTHON_EXECUTABLE=(python)
1117 else
1218 echo " Error: Python not found or not runnable"
@@ -15,9 +21,9 @@ case "$OSTYPE" in
1521 ;;
1622 * )
1723 echo " Running ${me} on linux / mac / unix"
18- if command -v python3 > /dev/null 2>&1 ; then
24+ if command -v python3 > /dev/null 2>&1 && is_python3 python3 ; then
1925 PYTHON_EXECUTABLE=(python3)
20- elif command -v python > /dev/null 2>&1 ; then
26+ elif command -v python > /dev/null 2>&1 && is_python3 python ; then
2127 PYTHON_EXECUTABLE=(python)
2228 else
2329 echo " Error: Python not found or not runnable"
Original file line number Diff line number Diff line change 11#! /usr/bin/env bash
22me=$( basename " $0 " )
33
4+ is_python3 () {
5+ " $1 " -c ' import sys; sys.exit(0 if sys.version_info[0] == 3 else 1)' > /dev/null 2>&1
6+ }
7+
48case " $OSTYPE " in
59 msys* |mingw* |cygwin* |win32* )
610 echo " Running ${me} on Windows"
7- if command -v python3 > /dev/null 2>&1 ; then
11+ if command -v python3 > /dev/null 2>&1 && is_python3 python3 ; then
812 PYTHON_EXECUTABLE=(python3)
9- elif command -v python > /dev/null 2>&1 ; then
13+ 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
14+ PYTHON_EXECUTABLE=(py -3)
15+ elif command -v python > /dev/null 2>&1 && is_python3 python; then
1016 PYTHON_EXECUTABLE=(python)
1117 else
1218 echo " Error: Python not found or not runnable"
@@ -15,9 +21,9 @@ case "$OSTYPE" in
1521 ;;
1622 * )
1723 echo " Running ${me} on linux / mac / unix"
18- if command -v python3 > /dev/null 2>&1 ; then
24+ if command -v python3 > /dev/null 2>&1 && is_python3 python3 ; then
1925 PYTHON_EXECUTABLE=(python3)
20- elif command -v python > /dev/null 2>&1 ; then
26+ elif command -v python > /dev/null 2>&1 && is_python3 python ; then
2127 PYTHON_EXECUTABLE=(python)
2228 else
2329 echo " Error: Python not found or not runnable"
Original file line number Diff line number Diff line change 11#! /usr/bin/env bash
22me=$( basename " $0 " )
33
4+ is_python3 () {
5+ " $1 " -c ' import sys; sys.exit(0 if sys.version_info[0] == 3 else 1)' > /dev/null 2>&1
6+ }
7+
48case " $OSTYPE " in
59 msys* |mingw* |cygwin* |win32* )
610 echo " Running ${me} on Windows"
7- if command -v python3 > /dev/null 2>&1 ; then
11+ if command -v python3 > /dev/null 2>&1 && is_python3 python3 ; then
812 PYTHON_EXECUTABLE=(python3)
9- elif command -v python > /dev/null 2>&1 ; then
13+ 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
14+ PYTHON_EXECUTABLE=(py -3)
15+ elif command -v python > /dev/null 2>&1 && is_python3 python; then
1016 PYTHON_EXECUTABLE=(python)
1117 else
1218 echo " Error: Python not found or not runnable"
@@ -15,9 +21,9 @@ case "$OSTYPE" in
1521 ;;
1622 * )
1723 echo " Running ${me} on linux / mac / unix"
18- if command -v python3 > /dev/null 2>&1 ; then
24+ if command -v python3 > /dev/null 2>&1 && is_python3 python3 ; then
1925 PYTHON_EXECUTABLE=(python3)
20- elif command -v python > /dev/null 2>&1 ; then
26+ elif command -v python > /dev/null 2>&1 && is_python3 python ; then
2127 PYTHON_EXECUTABLE=(python)
2228 else
2329 echo " Error: Python not found or not runnable"
You can’t perform that action at this time.
0 commit comments