From 421b5e3b26725f6799f118d7f819747281da76a1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?F=C3=A9lix=20Pi=C3=A9dallu?= Date: Mon, 29 Jan 2024 18:26:23 +0100 Subject: [PATCH] Try to fix venv --- scripts/_common.sh | 17 +++++++++++++++-- scripts/install | 8 ++++---- 2 files changed, 19 insertions(+), 6 deletions(-) diff --git a/scripts/_common.sh b/scripts/_common.sh index 6b28494..4fa380b 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -4,6 +4,19 @@ # COMMON VARIABLES #================================================= +#================================================= +# PERSONAL HELPERS +#================================================= + +_searx_venv_install() { + ynh_exec_as "$app" python3 -m venv --upgrade "$install_dir/venv" + venvpy="$install_dir/venv/bin/python3" + + ynh_exec_as "$app" "$venvpy" -m pip install --upgrade --no-cache-dir pip + + ynh_exec_as "$app" "$venvpy" -m pip install setuptools wheel pyyaml +} + #================================================= # UWSGI HELPERS #================================================= @@ -89,7 +102,7 @@ ynh_add_uwsgi_service () { for var_to_replace in $others_var do # ${var_to_replace^^} make the content of the variable on upper-cases - # ${!var_to_replace} get the content of the variable named $var_to_replace + # ${!var_to_replace} get the content of the variable named $var_to_replace ynh_replace_string --match_string "__${var_to_replace^^}__" --replace_string "${!var_to_replace}" --target_file "$finaluwsgiini" done @@ -232,7 +245,7 @@ ynh_regex_secure_remove () { if [ -z "$regex" ] then ynh_print_info --message="'$file_to_remove' wasn't deleted because it doesn't exist." - fi + fi fi fi done <<< "$(echo "$files_to_remove")" diff --git a/scripts/install b/scripts/install index f08e713..cb49805 100644 --- a/scripts/install +++ b/scripts/install @@ -36,10 +36,10 @@ ynh_add_nginx_config "path_no_root" #================================================= ynh_script_progression --message="Installing Searx..." --weight=2 -pushd $install_dir - python3 -m venv --upgrade "$install_dir/venv" - ynh_exec_as "$app" venv/bin/pip3 install -U pip setuptools wheel pyyaml --no-cache-dir - ynh_exec_as "$app" venv/bin/pip3 install --requirement $install_dir/requirements-ynh.txt --no-cache-dir +_searx_venv_install + +pushd "$install_dir" + ynh_exec_as "$app" "$venvpy" -m pip install --requirement ./requirements-ynh.txt --no-cache-dir popd #=================================================