Ensure our venv uses the correct python interpreter, even if the user has set a different version using update-alternatives or similar. Partially fixes #6279

This commit is contained in:
Dave Page 2021-03-08 11:17:55 +00:00
parent 7d3903463c
commit 059dad747d

View File

@ -211,5 +211,13 @@ _copy_code() {
# Web setup script
mkdir -p "${WEBROOT}/usr/${APP_NAME}/bin/"
cp "${SOURCEDIR}/pkg/linux/setup-web.sh" "${WEBROOT}/usr/${APP_NAME}/bin/"
# Ensure our venv will use the correct Python interpretor, even if the
# user has configured an alternative default.
# DO THIS LAST!
cd "${SERVERROOT}/usr/${APP_NAME}/venv/bin"
PYTHON_INTERPRETER=$(/usr/bin/python3 -c "import os, sys; print(os.path.realpath(sys.executable))")
rm python && ln -s python3 python
rm python3 && ln -s "${PYTHON_INTERPRETER}" python3
}