Commit dbbb9f82 authored by David Trattnig's avatar David Trattnig
Browse files

Dynamically use a compatible Python version. #17

parent d47aaf1b
#!/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)
......
#!/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)
......
......@@ -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
......
......@@ -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 \
......
#!/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)
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment