From 94345154e8fd72e1a4f12816232d759974cceade Mon Sep 17 00:00:00 2001 From: Lars Kruse <devel@sumpfralle.de> Date: Fri, 11 Mar 2022 23:16:22 +0100 Subject: [PATCH] refactor(run.sh): unify calling of python * `/usr/bin/env` is not necessary: `python3` is just the same (`/usr/bin/env python3` is helpful in a shebang, since an absolute path is required there) * use the variable `$PYTHON_EXEC`: it was introduced recently, but not used for now --- run.sh | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/run.sh b/run.sh index bd5d455..e08f904 100755 --- a/run.sh +++ b/run.sh @@ -34,7 +34,7 @@ echo "[ Docker=$docker ]" # Check for the correct Python version (3.8+) PYTHON_EXEC="python3" -echo "[ Using $(python3 -V) ]" +echo "[ Using $("$PYTHON_EXEC" -V) ]" # +++ DEFAULT COMMANDS +++ # @@ -45,24 +45,24 @@ if [[ $docker == "false" ]]; then if [[ $mode == "dev" ]]; then source python/bin/activate - echo "Running Engine API in Python Environment ($(python3 -V))" + echo "Running Engine API in Python Environment ($("$PYTHON_EXEC" -V))" echo "Starting API Server" - python src/app.py + "$PYTHON_EXEC" src/app.py fi ### Runs the API Server (Test) ### if [[ $mode == "api-test-0" ]]; then echo "Starting API Server 0" - /usr/bin/env python3 src/app.py config=tests/config/engine-0-api.ini + "$PYTHON_EXEC" src/app.py config=tests/config/engine-0-api.ini fi if [[ $mode == "api-test-1" ]]; then echo "Starting API Server 1" - /usr/bin/env python3 src/app.py config=tests/config/engine-1-api.ini + "$PYTHON_EXEC" src/app.py config=tests/config/engine-1-api.ini fi if [[ $mode == "api-test-2" ]]; then echo "Starting API Server 2" - /usr/bin/env python3 src/app.py config=tests/config/engine-2-api.ini + "$PYTHON_EXEC" src/app.py config=tests/config/engine-2-api.ini fi ### Runs the API Server using Gunicorn without a system daemon (Production) ### @@ -80,7 +80,7 @@ if [[ $docker == "false" ]]; then ### CAUTION: This deletes everything in your database ### if [[ $mode == "recreate-database" ]]; then - /usr/bin/env python3 src/app.py --recreate-database + "$PYTHON_EXEC" src/app.py --recreate-database fi fi @@ -117,4 +117,4 @@ if [[ $docker == "true" ]]; then if [[ $mode == "push" ]]; then exec sudo docker push autoradio/engine-api fi -fi \ No newline at end of file +fi -- GitLab