Try to fix backup/restore

see: https://ci-apps-dev.yunohost.org/ci/job/18484
This commit is contained in:
Jens Diemer 2024-08-25 18:04:22 +02:00
parent 7f37c910b7
commit 38a3a1b1eb
3 changed files with 14 additions and 13 deletions

View file

@ -31,7 +31,7 @@ services = ["__APP__"]
type = "boolean" type = "boolean"
yes = "1" yes = "1"
no = "0" 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" bind = "debug_enabled:/home/yunohost.app/__APP__/settings.py"
[main.config.log_level] [main.config.log_level]

View file

@ -86,13 +86,11 @@ myynh_install_python() {
if $(dpkg --compare-versions $py_built_version ge $python) if $(dpkg --compare-versions $py_built_version ge $python)
then then
# Built >= Required # Built >= Required
ynh_print_info --message="Using already used python3 built version..."
py_app_version="/usr/local/bin/python${py_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 else
# APT < Minimal & Actual < Minimal => Build & install Python into /usr/local/bin # 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 # Store current direcotry
local MY_DIR=$(pwd) local MY_DIR=$(pwd)
@ -126,21 +124,25 @@ myynh_install_python() {
fi fi
# Save python version in settings # Save python version in settings
ynh_app_setting_set --app=$app --key=python --value="$python" 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() { myynh_setup_python_venv() {
# Always recreate everything fresh with current python version # Install Python if needed:
ynh_secure_remove "$data_dir/venv"
myynh_install_python --python="$py_required_version" myynh_install_python --python="$py_required_version"
# Create a virtualenv with python installed by myynh_install_python(): # Create a virtualenv with python installed by myynh_install_python():
# Skip pip because of: https://github.com/YunoHost/issues/issues/1960 # 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' # run source in a 'sub shell'
( (
@ -148,8 +150,7 @@ myynh_setup_python_venv() {
source "$data_dir/venv/bin/activate" source "$data_dir/venv/bin/activate"
set -o nounset set -o nounset
set -x set -x
ynh_exec_as $app $data_dir/venv/bin/python3 -m ensurepip ynh_exec_as $app $data_dir/venv/bin/pip3 install --upgrade pip wheel setuptools
ynh_exec_as $app $data_dir/venv/bin/pip3 install --upgrade wheel pip setuptools
ynh_exec_as $app $data_dir/venv/bin/pip3 install --no-deps -r "$data_dir/requirements.txt" ynh_exec_as $app $data_dir/venv/bin/pip3 install --no-deps -r "$data_dir/requirements.txt"
) )
} }