From eb92969ccdfb9380482a0b52e78668ac702b400b Mon Sep 17 00:00:00 2001 From: Alexandre Aubin Date: Sat, 2 Dec 2023 23:07:19 +0100 Subject: [PATCH] Dunno what the heck with the venv, let's try to switch to a more standard workflow ... --- conf/uwsgi.ini | 4 ++-- scripts/install | 9 +++++---- scripts/upgrade | 14 +++++++++----- 3 files changed, 16 insertions(+), 11 deletions(-) diff --git a/conf/uwsgi.ini b/conf/uwsgi.ini index 580f1c9..4db9104 100644 --- a/conf/uwsgi.ini +++ b/conf/uwsgi.ini @@ -26,8 +26,8 @@ route-run = fixpathinfo: module = searx.webapp # Virtualenv and python path -virtualenv = __INSTALL_DIR__ -pythonpath = __INSTALL_DIR__ +virtualenv = __INSTALL_DIR__/venv +pythonpath = __INSTALL_DIR__/venv chdir = __INSTALL_DIR__/searx/ # The variable holding flask application diff --git a/scripts/install b/scripts/install index f91e008..cde24c9 100644 --- a/scripts/install +++ b/scripts/install @@ -36,10 +36,11 @@ ynh_add_nginx_config "path_no_root" #================================================= ynh_script_progression --message="Installing Searx..." --weight=2 -python3 -m venv --system-site-packages "$install_dir" -set +u; source $install_dir/bin/activate; set -u -pip3 install -U pip setuptools wheel pyyaml --no-cache-dir -pip3 install --requirement $install_dir/requirements-ynh.txt --no-cache-dir +pushd $install_dir + python3 -m venv venv + venv/bin/pip3 install -U pip setuptools wheel pyyaml --no-cache-dir + venv/bin/pip3 install --requirement $install_dir/requirements-ynh.txt --no-cache-dir +popd #================================================= # CONFIGURE SEARX diff --git a/scripts/upgrade b/scripts/upgrade index 8976439..ff02495 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -67,20 +67,24 @@ ynh_add_nginx_config "path_no_root" ynh_script_progression --message="Upgrading Searx..." --weight=7 # Clean venv if it still on python2 -if [ ! -e $install_dir/bin/python3 ] +if [ -e $install_dir/bin ] && [ ! -e $install_dir/bin/python3 ] then ynh_regex_secure_remove --file=$install_dir/lib/ --regex='python[^/.]*' ynh_regex_secure_remove --file=$install_dir/lib64/ --regex='python[^/.]*' ynh_regex_secure_remove --file=$install_dir/share/python-wheels fi + ynh_regex_secure_remove --file=$install_dir/lib/python3/site-packages/setuptools ynh_regex_secure_remove --file=$install_dir/lib/python3/site-packages/ --regex='setuptools-[^/.]*' -python3 -m venv --system-site-packages "$install_dir" +ynh_regex_secure_remove --file=$install_dir/venv/lib/python3/site-packages/setuptools +ynh_regex_secure_remove --file=$install_dir/venv/lib/python3/site-packages/ --regex='setuptools-[^/.]*' -set +u; source $install_dir/bin/activate; set -u -pip3 install -U setuptools -pip3 install --requirement $install_dir/requirements-ynh.txt --upgrade +pushd $install_dir + python3 -m venv venv + venv/bin/pip3 install -U pip setuptools wheel pyyaml --no-cache-dir + venv/bin/pip3 install --requirement $install_dir/requirements-ynh.txt --no-cache-dir +popd chown -R $app: "$install_dir"