|
|
@@ -28,6 +28,56 @@ then
|
|
|
venv_dir="venv"
|
|
|
fi
|
|
|
|
|
|
+if [[ $use_venv -eq 1 ]] && [[ -z "${VIRTUAL_ENV}" ]];
|
|
|
+then
|
|
|
+ printf "\n%s\n" "${delimiter}"
|
|
|
+ printf "Create and activate python venv"
|
|
|
+ printf "\n%s\n" "${delimiter}"
|
|
|
+ cd "${install_dir}"/"${clone_dir}"/ || { printf "\e[1m\e[31mERROR: Can't cd to %s/%s/, aborting...\e[0m" "${install_dir}" "${clone_dir}"; exit 1; }
|
|
|
+ if [[ ! -d "${venv_dir}" ]]
|
|
|
+ then
|
|
|
+ "${python_cmd}" -m venv "${venv_dir}"
|
|
|
+ first_launch=1
|
|
|
+ fi
|
|
|
+ # shellcheck source=/dev/null
|
|
|
+ if [[ -f "${venv_dir}"/bin/activate ]]
|
|
|
+ then
|
|
|
+ source "${venv_dir}"/bin/activate
|
|
|
+ else
|
|
|
+ printf "\n%s\n" "${delimiter}"
|
|
|
+ printf "\e[1m\e[31mERROR: Cannot activate python venv, aborting...\e[0m"
|
|
|
+ printf "\n%s\n" "${delimiter}"
|
|
|
+ exit 1
|
|
|
+ fi
|
|
|
+else
|
|
|
+ printf "\n%s\n" "${delimiter}"
|
|
|
+ printf "python venv already activate or run without venv: ${VIRTUAL_ENV}"
|
|
|
+ printf "\n%s\n" "${delimiter}"
|
|
|
+fi
|
|
|
+
|
|
|
+# Install requirements
|
|
|
+if [[ $use_venv -eq 1 ]]
|
|
|
+then
|
|
|
+ if [[ $first_launch -eq 1 ]]
|
|
|
+ then
|
|
|
+ printf "\n%s\n" "${delimiter}"
|
|
|
+ printf "Install requirements"
|
|
|
+ printf "\n%s\n" "${delimiter}"
|
|
|
+ "${python_cmd}" -m pip install --upgrade pip
|
|
|
+ "${python_cmd}" -m pip install -r requirements/requirements.txt
|
|
|
+ else
|
|
|
+ printf "\n%s\n" "${delimiter}"
|
|
|
+ printf "Requirements already installed"
|
|
|
+ printf "\n%s\n" "${delimiter}"
|
|
|
+ fi
|
|
|
+else
|
|
|
+ printf "\n%s\n" "${delimiter}"
|
|
|
+ printf "Run without venv"
|
|
|
+ printf "\n%s\n" "${delimiter}"
|
|
|
+ "${python_cmd}" -m pip install --upgrade pip
|
|
|
+ "${python_cmd}" -m pip install -r requirements/requirements.txt
|
|
|
+fi
|
|
|
+
|
|
|
while true
|
|
|
do
|
|
|
if [ -z "$PYTHON" ]; then
|