diff --git a/engine-core.py b/engine-core.py index 3d0b50bf36cacaf51999cf22b306abfd7b7aaf57..23b741412229a5a259c070dcd1c0b657aa983d19 100755 --- a/engine-core.py +++ b/engine-core.py @@ -1,4 +1,7 @@ -#!/usr/bin/env python3.7 +#!/bin/sh +''''which python3.8 >/dev/null 2>&1 && exec python3.8 "$0" "$@" # ''' +''''which python3.7 >/dev/null 2>&1 && exec python3.7 "$0" "$@" # ''' +''''exec echo "Error: Snaaakey Python, where are you?" # ''' # # Aura Engine (https://gitlab.servus.at/aura/engine) diff --git a/guru.py b/guru.py index 19cb9d9aad77ed5245d4c345e67972ee31444c68..f0b8e981a01ceabc2615c3df1375fcc6c9dd0848 100755 --- a/guru.py +++ b/guru.py @@ -1,4 +1,7 @@ -#!/usr/bin/env python3.7 +#!/bin/sh +''''which python3.8 >/dev/null 2>&1 && exec python3.8 "$0" "$@" # ''' +''''which python3.7 >/dev/null 2>&1 && exec python3.7 "$0" "$@" # ''' +''''exec echo "Error: Snaaakey Python, where are you?" # ''' # # Aura Engine (https://gitlab.servus.at/aura/engine) diff --git a/install.sh b/install.sh index a7718e297bb4d3992c0e98d0da275304eb32bff1..d654327b9e200fe62d2fa15fa23e0b468332baf8 100755 --- a/install.sh +++ b/install.sh @@ -13,6 +13,15 @@ if [ $mode == "prod" ]; then echo "[Installing AURA ENGINE for Production]" fi +# Find the correct Python version (3.7 or 3.8) + +if hash python3.8 2>/dev/null; then + PYTHON_EXEC="python3.8" + echo "[ Using Python 3.8 ]" +else + PYTHON_EXEC="python3.7" + echo "[ Using Python 3.7 ]" +fi # Development and Production @@ -20,7 +29,7 @@ echo "Installing OPAM Packages ..." bash script/install-opam-packages.sh echo "Installing Python Requirements ..." -python3.7 $(which pip3) install -r requirements.txt +$PYTHON_EXEC $(which pip3) install -r requirements.txt # Development diff --git a/run.sh b/run.sh index 9dfb4ffad37ea77bce93e689c2454392b4391f61..942775398d366e1c6adc5c861f5d39b36afdf89f 100755 --- a/run.sh +++ b/run.sh @@ -32,6 +32,16 @@ echo "[ Run mode=$mode ]" echo "[ Docker=$docker ]" +# Find the correct Python version (3.7 or 3.8) + +if hash python3.8 2>/dev/null; then + PYTHON_EXEC="python3.8" + echo "[ Using Python 3.8 ]" +else + PYTHON_EXEC="python3.7" + echo "[ Using Python 3.7 ]" +fi + # +++ DEFAULT COMMANDS +++ # @@ -48,26 +58,26 @@ if [[ $docker == "false" ]]; then if [[ $mode == "engine" ]]; then eval $(opam env) - /usr/bin/env python3.7 engine-core.py + /usr/bin/env $PYTHON_EXEC engine-core.py fi ### Runs Engine Core only ### if [[ $mode == "core" ]]; then - /usr/bin/env python3.7 engine-core.py --without-lqs + /usr/bin/env $PYTHON_EXEC engine-core.py --without-lqs fi ### Runs Liquidsoap only ### if [[ $mode == "lqs" ]]; then - lqs=$(/usr/bin/env python3.7 engine-core.py --get-lqs-command) + lqs=$(/usr/bin/env $PYTHON_EXEC engine-core.py --get-lqs-command) eval "$lqs" fi ### CAUTION: This deletes everything in your database ### if [[ $mode == "recreate-database" ]]; then - /usr/bin/env python3.7 engine-core.py --recreate-database + /usr/bin/env $PYTHON_EXEC engine-core.py --recreate-database fi fi @@ -87,7 +97,7 @@ if [[ $docker == "true" ]]; then --rm -d \ -u $UID:$GID \ -v "$BASE_D":/srv \ - -v "$BASE_D/audio/source":/home/opam/audio/source:ro \ + -v "$BASE_D/audio/source":/var/audio/source:ro \ -v "$BASE_D/configuration/docker":/etc/aura \ -v "/dev/snd":/dev/snd \ --privileged \ diff --git a/test/tests.py b/test/tests.py index 51bbab631da3ffe97322607280e84ebaf8bb4d49..b99c4e1b8ea86ed6c9321072d9436bed1c258a5f 100755 --- a/test/tests.py +++ b/test/tests.py @@ -1,4 +1,7 @@ -#!/usr/bin/python3.7 +#!/bin/sh +''''which python3.8 >/dev/null 2>&1 && exec python3.8 "$0" "$@" # ''' +''''which python3.7 >/dev/null 2>&1 && exec python3.7 "$0" "$@" # ''' +''''exec echo "Error: Snaaakey Python, where are you?" # ''' # # Aura Engine (https://gitlab.servus.at/aura/engine)