From 38a3a1b1ebabde135c00de6672e705e20785b030 Mon Sep 17 00:00:00 2001 From: Jens Diemer Date: Sun, 25 Aug 2024 18:04:22 +0200 Subject: [PATCH] Try to fix backup/restore see: https://ci-apps-dev.yunohost.org/ci/job/18484 --- config_panel.toml | 2 +- scripts/_common.sh | 23 ++++++++++++----------- scripts/restore | 2 +- 3 files changed, 14 insertions(+), 13 deletions(-) diff --git a/config_panel.toml b/config_panel.toml index 9a8148e..a776fb5 100644 --- a/config_panel.toml +++ b/config_panel.toml @@ -31,7 +31,7 @@ services = ["__APP__"] type = "boolean" yes = "1" no = "0" - help = "Should be never enabled in production!" + help = "Enable DEBUG mode? (Should be never enabled in production!)" bind = "debug_enabled:/home/yunohost.app/__APP__/settings.py" [main.config.log_level] diff --git a/scripts/_common.sh b/scripts/_common.sh index 5a653db..958cf6c 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -86,13 +86,11 @@ myynh_install_python() { if $(dpkg --compare-versions $py_built_version ge $python) then # Built >= Required - ynh_print_info --message="Using already used python3 built version..." - py_app_version="/usr/local/bin/python${py_built_version%.*}" - + ynh_print_info --message="Using already used python3 built version: $py_app_version" else # APT < Minimal & Actual < Minimal => Build & install Python into /usr/local/bin - ynh_print_info --message="Building python (may take a while)..." + ynh_print_info --message="Building $python (may take a while)..." # Store current direcotry local MY_DIR=$(pwd) @@ -126,21 +124,25 @@ myynh_install_python() { fi # Save python version in settings ynh_app_setting_set --app=$app --key=python --value="$python" + + # Print some version information: + ynh_print_info --message="Python version: $($py_app_version -VV)" + ynh_print_info --message="Pip version: $($py_app_version -m pip -V)" } #================================================================================== #================================================================================== myynh_setup_python_venv() { - # Always recreate everything fresh with current python version - ynh_secure_remove "$data_dir/venv" - + # Install Python if needed: myynh_install_python --python="$py_required_version" # Create a virtualenv with python installed by myynh_install_python(): # Skip pip because of: https://github.com/YunoHost/issues/issues/1960 - $py_app_version -m venv --without-pip "$data_dir/venv" + ynh_exec_as $app $py_app_version -m venv --clear --upgrade-deps "$data_dir/venv" - chown -c -R "$app:" "$data_dir" + # Print some version information: + ynh_print_info --message="venv Python version: $($data_dir/venv/bin/python3 -VV)" + ynh_print_info --message="venv Pip version: $($data_dir/venv/bin/python3 -m pip -V)" # run source in a 'sub shell' ( @@ -148,8 +150,7 @@ myynh_setup_python_venv() { source "$data_dir/venv/bin/activate" set -o nounset set -x - ynh_exec_as $app $data_dir/venv/bin/python3 -m ensurepip - ynh_exec_as $app $data_dir/venv/bin/pip3 install --upgrade wheel pip setuptools + ynh_exec_as $app $data_dir/venv/bin/pip3 install --upgrade pip wheel setuptools ynh_exec_as $app $data_dir/venv/bin/pip3 install --no-deps -r "$data_dir/requirements.txt" ) } diff --git a/scripts/restore b/scripts/restore index 2415146..0fc3c82 100755 --- a/scripts/restore +++ b/scripts/restore @@ -21,7 +21,7 @@ ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf" #================================================= # RESTORE THE APP MAIN DIR #================================================= -ynh_script_progression --message="Restoring $app main directory..." +ynh_script_progression --message="Restoring $app main directory..." ynh_restore_file --origin_path="$install_dir" ynh_restore_file --origin_path="$data_dir"