2023-01-16 06:52:22 +00:00
#!/bin/bash
2023-01-01 17:54:45 +00:00
2022-12-11 05:37:08 +00:00
# make sure we are not already in a venv
# (don't need to check status)
deactivate >/dev/null 2>& 1
2023-02-04 02:42:00 +00:00
scriptdir = $( dirname " $0 " )
cd $scriptdir
2022-12-11 05:37:08 +00:00
2023-02-04 02:42:00 +00:00
function version { echo " $@ " | awk -F. '{ printf("%d%03d%03d%03d\n", $1,$2,$3,$4); }' ; }
MINIMUM_PYTHON_VERSION = 3.9.0
2023-02-16 17:52:07 +00:00
MAXIMUM_PYTHON_VERSION = 3.11.0
2023-02-04 02:42:00 +00:00
PYTHON = ""
2023-02-16 17:52:07 +00:00
for candidate in python3.10 python3.9 python3 python ; do
2023-02-04 02:42:00 +00:00
if ppath = ` which $candidate ` ; then
python_version = $( $ppath -V | awk '{ print $2 }' )
if [ $( version $python_version ) -ge $( version " $MINIMUM_PYTHON_VERSION " ) ] ; then
2023-02-16 17:52:07 +00:00
if [ $( version $python_version ) -lt $( version " $MAXIMUM_PYTHON_VERSION " ) ] ; then
PYTHON = $ppath
break
fi
2023-02-04 02:42:00 +00:00
fi
fi
done
if [ -z " $PYTHON " ] ; then
echo "A suitable Python interpreter could not be found"
2023-06-16 13:18:23 +00:00
echo " Please install Python $MINIMUM_PYTHON_VERSION or higher (maximum $MAXIMUM_PYTHON_VERSION ) before running this script. See instructions at $INSTRUCTIONS for help. "
2023-06-08 20:37:10 +00:00
echo "For the best user experience we suggest enlarging or maximizing this window now."
2023-02-04 02:42:00 +00:00
read -p "Press any key to exit"
exit -1
fi
2023-02-07 21:35:22 +00:00
exec $PYTHON ./lib/main.py ${ @ }
2023-02-22 01:03:08 +00:00
read -p "Press any key to exit"