Skip to content
Snippets Groups Projects
Commit dbbb9f82 authored by David Trattnig's avatar David Trattnig
Browse files

Dynamically use a compatible Python version. #17

parent d47aaf1b
No related branches found
No related tags found
No related merge requests found
#!/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) # Aura Engine (https://gitlab.servus.at/aura/engine)
......
#!/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) # Aura Engine (https://gitlab.servus.at/aura/engine)
......
...@@ -13,6 +13,15 @@ if [ $mode == "prod" ]; then ...@@ -13,6 +13,15 @@ if [ $mode == "prod" ]; then
echo "[Installing AURA ENGINE for Production]" echo "[Installing AURA ENGINE for Production]"
fi 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 # Development and Production
...@@ -20,7 +29,7 @@ echo "Installing OPAM Packages ..." ...@@ -20,7 +29,7 @@ echo "Installing OPAM Packages ..."
bash script/install-opam-packages.sh bash script/install-opam-packages.sh
echo "Installing Python Requirements ..." echo "Installing Python Requirements ..."
python3.7 $(which pip3) install -r requirements.txt $PYTHON_EXEC $(which pip3) install -r requirements.txt
# Development # Development
......
...@@ -32,6 +32,16 @@ echo "[ Run mode=$mode ]" ...@@ -32,6 +32,16 @@ echo "[ Run mode=$mode ]"
echo "[ Docker=$docker ]" 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 +++ # # +++ DEFAULT COMMANDS +++ #
...@@ -48,26 +58,26 @@ if [[ $docker == "false" ]]; then ...@@ -48,26 +58,26 @@ if [[ $docker == "false" ]]; then
if [[ $mode == "engine" ]]; then if [[ $mode == "engine" ]]; then
eval $(opam env) eval $(opam env)
/usr/bin/env python3.7 engine-core.py /usr/bin/env $PYTHON_EXEC engine-core.py
fi fi
### Runs Engine Core only ### ### Runs Engine Core only ###
if [[ $mode == "core" ]]; then 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 fi
### Runs Liquidsoap only ### ### Runs Liquidsoap only ###
if [[ $mode == "lqs" ]]; then 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" eval "$lqs"
fi fi
### CAUTION: This deletes everything in your database ### ### CAUTION: This deletes everything in your database ###
if [[ $mode == "recreate-database" ]]; then 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
fi fi
...@@ -87,7 +97,7 @@ if [[ $docker == "true" ]]; then ...@@ -87,7 +97,7 @@ if [[ $docker == "true" ]]; then
--rm -d \ --rm -d \
-u $UID:$GID \ -u $UID:$GID \
-v "$BASE_D":/srv \ -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 "$BASE_D/configuration/docker":/etc/aura \
-v "/dev/snd":/dev/snd \ -v "/dev/snd":/dev/snd \
--privileged \ --privileged \
......
#!/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) # Aura Engine (https://gitlab.servus.at/aura/engine)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment