Skip to content

Commit

Permalink
Stop using a subshell, just call venv directly.
Browse files Browse the repository at this point in the history
  • Loading branch information
Salamandar committed Jun 5, 2024
1 parent f5a1739 commit bd787c3
Showing 1 changed file with 8 additions and 15 deletions.
23 changes: 8 additions & 15 deletions scripts/restore
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ ynh_restore_file --origin_path="/opt/kepubify/$app"
#=================================================
# RESTORE USER RIGHTS
#=================================================
chown -R $app: $install_dir
chown -R "$app:" "$install_dir"
chmod 740 $install_dir

#Use venv to install pip requirements - Inspired from https://github.com/YunoHost-Apps/pyinventory_ynh/blob/master/scripts/install
Expand All @@ -45,21 +45,14 @@ if [ -d "${install_dir}/venv" ] ; then
ynh_secure_remove "${install_dir}/venv"
fi

pushd "$install_dir"
# Skip pip because of: https://github.com/YunoHost/issues/issues/1960
python3 -m venv --without-pip "${install_dir}/venv"
chown -R "$app:" "$install_dir"

#run source in a 'sub shell'
(
cd "$install_dir"
set +o nounset
source "venv/bin/activate"
set -o nounset
ynh_exec_as $app venv/bin/python3 -m ensurepip
ynh_exec_as $app venv/bin/pip3 install --upgrade wheel pip setuptools
ynh_exec_as $app venv/bin/pip3 install --no-cache-dir --upgrade -r "$install_dir/requirements.txt"
ynh_exec_as $app venv/bin/pip3 install --no-cache-dir --upgrade -r "$install_dir/optional-requirements.txt"
)
ynh_exec_as "$app" python3 -m venv --without-pip "$install_dir/venv"
ynh_exec_as "$app" venv/bin/python3 -m ensurepip
ynh_exec_as "$app" venv/bin/pip3 install --upgrade wheel pip setuptools
ynh_exec_as "$app" venv/bin/pip3 install --no-cache-dir --upgrade -r "$install_dir/requirements.txt"
ynh_exec_as "$app" venv/bin/pip3 install --no-cache-dir --upgrade -r "$install_dir/optional-requirements.txt"
popd

#=================================================
# RESTORE SYSTEMD
Expand Down

0 comments on commit bd787c3

Please sign in to comment.