Commit d5c850aa authored by AUTOMATIC1111's avatar AUTOMATIC1111 Committed by GitHub

Merge pull request #11866 from kopyl/allow-no-venv-install

Make possible to install web ui without venv with venv_dir=- env variable for Linux
parents c2b97548 0a334b44
...@@ -4,8 +4,15 @@ ...@@ -4,8 +4,15 @@
# change the variables in webui-user.sh instead # # change the variables in webui-user.sh instead #
################################################# #################################################
use_venv=1
if [[ $venv_dir == "-" ]]; then
use_venv=0
fi
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd ) SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
# If run from macOS, load defaults from webui-macos-env.sh # If run from macOS, load defaults from webui-macos-env.sh
if [[ "$OSTYPE" == "darwin"* ]]; then if [[ "$OSTYPE" == "darwin"* ]]; then
if [[ -f "$SCRIPT_DIR"/webui-macos-env.sh ]] if [[ -f "$SCRIPT_DIR"/webui-macos-env.sh ]]
...@@ -47,7 +54,7 @@ then ...@@ -47,7 +54,7 @@ then
fi fi
# python3 venv without trailing slash (defaults to ${install_dir}/${clone_dir}/venv) # python3 venv without trailing slash (defaults to ${install_dir}/${clone_dir}/venv)
if [[ -z "${venv_dir}" ]] if [[ -z "${venv_dir}" ]] && [[ $use_venv -eq 1 ]]
then then
venv_dir="venv" venv_dir="venv"
fi fi
...@@ -164,7 +171,7 @@ do ...@@ -164,7 +171,7 @@ do
fi fi
done done
if ! "${python_cmd}" -c "import venv" &>/dev/null if [[ $use_venv -eq 1 ]] && ! "${python_cmd}" -c "import venv" &>/dev/null
then then
printf "\n%s\n" "${delimiter}" printf "\n%s\n" "${delimiter}"
printf "\e[1m\e[31mERROR: python3-venv is not installed, aborting...\e[0m" printf "\e[1m\e[31mERROR: python3-venv is not installed, aborting...\e[0m"
...@@ -184,7 +191,7 @@ else ...@@ -184,7 +191,7 @@ else
cd "${clone_dir}"/ || { printf "\e[1m\e[31mERROR: Can't cd to %s/%s/, aborting...\e[0m" "${install_dir}" "${clone_dir}"; exit 1; } cd "${clone_dir}"/ || { printf "\e[1m\e[31mERROR: Can't cd to %s/%s/, aborting...\e[0m" "${install_dir}" "${clone_dir}"; exit 1; }
fi fi
if [[ -z "${VIRTUAL_ENV}" ]]; if [[ $use_venv -eq 1 ]] && [[ -z "${VIRTUAL_ENV}" ]];
then then
printf "\n%s\n" "${delimiter}" printf "\n%s\n" "${delimiter}"
printf "Create and activate python venv" printf "Create and activate python venv"
...@@ -207,7 +214,7 @@ then ...@@ -207,7 +214,7 @@ then
fi fi
else else
printf "\n%s\n" "${delimiter}" printf "\n%s\n" "${delimiter}"
printf "python venv already activate: ${VIRTUAL_ENV}" printf "python venv already activate or run without venv: ${VIRTUAL_ENV}"
printf "\n%s\n" "${delimiter}" printf "\n%s\n" "${delimiter}"
fi fi
......
Markdown is supported
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