|
#!/bin/bash |
|
|
|
|
|
|
|
deactivate >/dev/null 2>&1 |
|
scriptdir=$(dirname "$0") |
|
cd $scriptdir |
|
|
|
function version { echo "$@" | awk -F. '{ printf("%d%03d%03d%03d\n", $1,$2,$3,$4); }'; } |
|
|
|
MINIMUM_PYTHON_VERSION=3.10.0 |
|
MAXIMUM_PYTHON_VERSION=3.11.100 |
|
PYTHON="" |
|
for candidate in python3.11 python3.10 python3 python ; do |
|
if ppath=`which $candidate 2>/dev/null`; then |
|
|
|
|
|
if [ $($candidate --version &>/dev/null; echo ${PIPESTATUS}) -gt 0 ]; then continue; fi |
|
|
|
python_version=$($ppath -V | awk '{ print $2 }') |
|
if [ $(version $python_version) -ge $(version "$MINIMUM_PYTHON_VERSION") ]; then |
|
if [ $(version $python_version) -le $(version "$MAXIMUM_PYTHON_VERSION") ]; then |
|
PYTHON=$ppath |
|
break |
|
fi |
|
fi |
|
fi |
|
done |
|
|
|
if [ -z "$PYTHON" ]; then |
|
echo "A suitable Python interpreter could not be found" |
|
echo "Please install Python $MINIMUM_PYTHON_VERSION or higher (maximum $MAXIMUM_PYTHON_VERSION) before running this script. See instructions at $INSTRUCTIONS for help." |
|
read -p "Press any key to exit" |
|
exit -1 |
|
fi |
|
|
|
echo "For the best user experience we suggest enlarging or maximizing this window now." |
|
|
|
exec $PYTHON ./lib/main.py ${@} |
|
read -p "Press any key to exit" |
|
|