mirror of
https://github.com/YunoHost-Apps/django_example_ynh.git
synced 2024-09-03 18:26:21 +02:00
Work-a-round: Split venv creation by using "--without-pip" and later "ensurepip"
See: https://github.com/YunoHost/issues/issues/1960
This commit is contained in:
parent
96a55325bd
commit
cb1998b5a5
3 changed files with 41 additions and 6 deletions
|
@ -103,7 +103,12 @@ ynh_system_user_create --username="$app" --home_dir="$final_path" --use_shell
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Install project via pip..." --weight=80
|
ynh_script_progression --message="Install project via pip..." --weight=80
|
||||||
|
|
||||||
python3 -m venv "${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"
|
||||||
|
|
||||||
cp ../conf/requirements.txt "$final_path/requirements.txt"
|
cp ../conf/requirements.txt "$final_path/requirements.txt"
|
||||||
chown -R "$app:" "$final_path"
|
chown -R "$app:" "$final_path"
|
||||||
|
|
||||||
|
@ -112,8 +117,9 @@ chown -R "$app:" "$final_path"
|
||||||
set +o nounset
|
set +o nounset
|
||||||
source "${final_path}/venv/bin/activate"
|
source "${final_path}/venv/bin/activate"
|
||||||
set -o nounset
|
set -o nounset
|
||||||
ynh_exec_as $app $final_path/venv/bin/pip install --upgrade pip
|
ynh_exec_as $app $final_path/venv/bin/python3 -m ensurepip
|
||||||
ynh_exec_as $app $final_path/venv/bin/pip install -r "$final_path/requirements.txt"
|
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"
|
||||||
)
|
)
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
|
@ -82,6 +82,29 @@ ynh_script_progression --message="Reinstalling dependencies..." --weight=40
|
||||||
|
|
||||||
ynh_exec_warn_less ynh_install_app_dependencies "$pkg_dependencies"
|
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=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"
|
||||||
|
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/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"
|
||||||
|
)
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# RESTORE THE PostgreSQL DATABASE
|
# RESTORE THE PostgreSQL DATABASE
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
|
@ -87,7 +87,12 @@ ynh_add_systemd_config --service="$app" --template="django_example_ynh.service"
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Upgrade project via pip..." --weight=80
|
ynh_script_progression --message="Upgrade project via pip..." --weight=80
|
||||||
|
|
||||||
python3 -m venv "${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"
|
||||||
|
|
||||||
cp ../conf/requirements.txt "$final_path/requirements.txt"
|
cp ../conf/requirements.txt "$final_path/requirements.txt"
|
||||||
chown -R "$app:" "$final_path"
|
chown -R "$app:" "$final_path"
|
||||||
|
|
||||||
|
@ -96,8 +101,9 @@ chown -R "$app:" "$final_path"
|
||||||
set +o nounset
|
set +o nounset
|
||||||
source "${final_path}/venv/bin/activate"
|
source "${final_path}/venv/bin/activate"
|
||||||
set -o nounset
|
set -o nounset
|
||||||
ynh_exec_as $app $final_path/venv/bin/pip install --upgrade pip
|
ynh_exec_as $app $final_path/venv/bin/python3 -m ensurepip
|
||||||
ynh_exec_as $app $final_path/venv/bin/pip install -r "$final_path/requirements.txt"
|
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"
|
||||||
)
|
)
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
Loading…
Reference in a new issue