1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/pyinventory_ynh.git synced 2024-09-03 20:16:09 +02:00

Merge pull request #76 from YunoHost-Apps/debug-venv-error

Debug venv error
This commit is contained in:
Jens Diemer 2021-11-22 22:33:23 +01:00 committed by GitHub
commit 94dadaa1da
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 25 additions and 8 deletions

View file

@ -112,8 +112,8 @@ 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/pip install --upgrade wheel pip
ynh_exec_as $app $final_path/venv/bin/pip install -r "$final_path/requirements.txt" ynh_exec_as $app $final_path/venv/bin/pip install --no-deps -r "$final_path/requirements.txt"
) )
#================================================= #=================================================

View file

@ -88,15 +88,15 @@ ynh_exec_warn_less ynh_install_app_dependencies "$pkg_dependencies"
#================================================= #=================================================
ynh_script_progression --message="Upgrade Python virtualenv..." --weight=10 ynh_script_progression --message="Upgrade Python virtualenv..." --weight=10
python3 -m venv --upgrade "${final_path}/venv" python3 -m venv "${final_path}/venv"
#run source in a 'sub shell' #run source in a 'sub shell'
( (
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/pip install --upgrade wheel pip
ynh_exec_as $app $final_path/venv/bin/pip install -r "$final_path/requirements.txt" ynh_exec_as $app $final_path/venv/bin/pip install --no-deps -r "$final_path/requirements.txt"
) )
#================================================= #=================================================

View file

@ -87,7 +87,7 @@ ynh_add_systemd_config --service="$app" --template="pyinventory.service"
#================================================= #=================================================
ynh_script_progression --message="Upgrade project via pip..." --weight=80 ynh_script_progression --message="Upgrade project via pip..." --weight=80
python3 -m venv --upgrade "${final_path}/venv" python3 -m venv "${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 +96,8 @@ 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/pip install --upgrade wheel pip
ynh_exec_as $app $final_path/venv/bin/pip install -r "$final_path/requirements.txt" ynh_exec_as $app $final_path/venv/bin/pip install --no-deps -r "$final_path/requirements.txt"
) )
#================================================= #=================================================

17
test_requirements.sh Executable file
View file

@ -0,0 +1,17 @@
#!/bin/bash
# Test to create the python virtual env and install all requirements.
# Note: Maybe you didn't have all OS packages installed ;)
set -e
final_path="./local_test"
set -x
mkdir -p "${final_path}/"
python3 -m venv "${final_path}/venv"
source "${final_path}/venv/bin/activate"
$final_path/venv/bin/pip install --upgrade wheel pip
$final_path/venv/bin/pip install --no-deps -r "./conf/requirements.txt"