@@ -6,36 +6,36 @@ venv_dir=".venv"
66# Find a suitable Python 3.9+ interpreter
77PYTHON_CMD=" "
88for cmd in python3.12 python3.11 python3.10 python3.9 python3 python; do
9- if command -v $cmd & > /dev/null; then
10- version=$( $cmd -c " import sys; print(f'{sys.version_info.major}.{sys.version_info.minor}')" 2> /dev/null)
11- major=$( echo $version | cut -d ' .' -f 1)
12- minor=$( echo $version | cut -d ' .' -f 2)
13- if [[ " $major " -ge 3 && " $minor " -ge 9 ]]; then
14- PYTHON_CMD=$cmd
15- break
16- fi
9+ if command -v $cmd & > /dev/null; then
10+ version=$( $cmd -c " import sys; print(f'{sys.version_info.major}.{sys.version_info.minor}')" 2> /dev/null)
11+ major=$( echo " $version " | cut -d ' .' -f 1)
12+ minor=$( echo " $version " | cut -d ' .' -f 2)
13+ if [[ " $major " -ge 3 && " $minor " -ge 9 ]]; then
14+ PYTHON_CMD=$cmd
15+ break
1716 fi
17+ fi
1818done
1919
2020if [[ -z " $PYTHON_CMD " ]]; then
21- echo " Python 3.9 or higher is required but not found."
22- echo " Please install Python 3.9+ and ensure it's in your PATH."
23- exit 1
21+ echo " Python 3.9 or higher is required but not found."
22+ echo " Please install Python 3.9+ and ensure it's in your PATH."
23+ exit 1
2424fi
2525
2626echo " Using Python: $PYTHON_CMD ($( ${PYTHON_CMD} --version) )"
2727
2828# Create virtual environment if it doesn't exist
2929if [[ ! -d " $venv_dir " ]]; then
30- echo " Creating virtual environment in $venv_dir ..."
31- $PYTHON_CMD -m venv $venv_dir
30+ echo " Creating virtual environment in $venv_dir ..."
31+ $PYTHON_CMD -m venv $venv_dir
3232fi
3333
3434# Activate virtual environment and install dependencies
35- source $venv_dir /bin/activate
35+ # shellcheck source=/dev/null
36+ source " $venv_dir /bin/activate"
3637echo " Virtual environment activated"
3738
38- cd $folder
39+ cd $folder || exit
3940pip install -r requirements.txt
4041python main.py
41-
0 commit comments