diff --git a/scripts/install b/scripts/install index 5f2aede..2989330 100755 --- a/scripts/install +++ b/scripts/install @@ -63,7 +63,7 @@ redis_db=$(ynh_redis_get_free_db) #================================================= # INSTALL DEPENDENCIES #================================================= -ynh_script_progression --message="Installing dependencies..." --weight=40 +ynh_script_progression --message="Installing dependencies..." --weight=20 ynh_exec_warn_less ynh_install_app_dependencies "$pkg_dependencies" @@ -101,9 +101,14 @@ ynh_system_user_create --username="$app" --home_dir="$final_path" --use_shell #================================================= # PIP INSTALLATION #================================================= -ynh_script_progression --message="Install project via pip..." --weight=80 +ynh_script_progression --message="Install project via pip..." --weight=50 + +# Always recreate everything fresh with current python version +ynh_secure_remove "${final_path}/venv" + +# Skip pip because of: https://github.com/YunoHost/issues/issues/1960 +python3 -m venv --without-pip "${final_path}/venv" -python3 -m venv "${final_path}/venv" cp ../conf/requirements.txt "$final_path/requirements.txt" chown -R "$app:" "$final_path" @@ -112,8 +117,9 @@ chown -R "$app:" "$final_path" set +o nounset source "${final_path}/venv/bin/activate" set -o nounset - ynh_exec_as $app $final_path/venv/bin/pip install --upgrade wheel pip - ynh_exec_as $app $final_path/venv/bin/pip install --no-deps -r "$final_path/requirements.txt" + ynh_exec_as $app $final_path/venv/bin/python3 -m ensurepip + ynh_exec_as $app $final_path/venv/bin/pip3 install --upgrade wheel pip setuptools + ynh_exec_as $app $final_path/venv/bin/pip3 install --no-deps -r "$final_path/requirements.txt" ) #================================================= diff --git a/scripts/restore b/scripts/restore index e4cbdfb..0cbf548 100755 --- a/scripts/restore +++ b/scripts/restore @@ -78,7 +78,7 @@ chown -R "$app:" "$final_path" #================================================= # REINSTALL DEPENDENCIES #================================================= -ynh_script_progression --message="Reinstalling dependencies..." --weight=40 +ynh_script_progression --message="Reinstalling dependencies..." --weight=20 ynh_exec_warn_less ynh_install_app_dependencies "$pkg_dependencies" @@ -86,17 +86,23 @@ ynh_exec_warn_less ynh_install_app_dependencies "$pkg_dependencies" # REINSTALL PYTHON VIRTUALENV # Maybe the backup contains a other Python version #================================================= -ynh_script_progression --message="Upgrade Python virtualenv..." --weight=10 +ynh_script_progression --message="Upgrade Python virtualenv..." --weight=50 -python3 -m venv --upgrade "${final_path}/venv" +# Always recreate everything fresh with current python version +ynh_secure_remove "${final_path}/venv" + +# Skip pip because of: https://github.com/YunoHost/issues/issues/1960 +python3 -m venv --without-pip "${final_path}/venv" +chown -R "$app:" "$final_path" #run source in a 'sub shell' ( set +o nounset source "${final_path}/venv/bin/activate" set -o nounset - ynh_exec_as $app $final_path/venv/bin/pip install --upgrade wheel pip - ynh_exec_as $app $final_path/venv/bin/pip install --no-deps -r "$final_path/requirements.txt" + ynh_exec_as $app $final_path/venv/bin/python3 -m ensurepip + ynh_exec_as $app $final_path/venv/bin/pip3 install --upgrade wheel pip setuptools + ynh_exec_as $app $final_path/venv/bin/pip3 install --no-deps -r "$final_path/requirements.txt" ) #================================================= diff --git a/scripts/upgrade b/scripts/upgrade index 5d21061..e533acb 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -63,7 +63,7 @@ ynh_add_nginx_config "public_path" "port" #================================================= # Update dependencies #================================================= -ynh_script_progression --message="Upgrading dependencies..." +ynh_script_progression --message="Upgrading dependencies..." --weight=20 ynh_exec_warn_less ynh_install_app_dependencies "$pkg_dependencies" @@ -85,9 +85,14 @@ ynh_add_systemd_config --service="$app" --template="pyinventory.service" #================================================= # UPGRADE VENV #================================================= -ynh_script_progression --message="Upgrade project via pip..." --weight=80 +ynh_script_progression --message="Upgrade project via pip..." --weight=50 + +# Always recreate everything fresh with current python version +ynh_secure_remove "${final_path}/venv" + +# Skip pip because of: https://github.com/YunoHost/issues/issues/1960 +python3 -m venv --without-pip "${final_path}/venv" -python3 -m venv --upgrade "${final_path}/venv" cp ../conf/requirements.txt "$final_path/requirements.txt" chown -R "$app:" "$final_path" @@ -96,8 +101,9 @@ chown -R "$app:" "$final_path" set +o nounset source "${final_path}/venv/bin/activate" set -o nounset - ynh_exec_as $app $final_path/venv/bin/pip install --upgrade wheel pip - ynh_exec_as $app $final_path/venv/bin/pip install --no-deps -r "$final_path/requirements.txt" + ynh_exec_as $app $final_path/venv/bin/python3 -m ensurepip + ynh_exec_as $app $final_path/venv/bin/pip3 install --upgrade wheel pip setuptools + ynh_exec_as $app $final_path/venv/bin/pip3 install --no-deps -r "$final_path/requirements.txt" ) #=================================================