From 1c83063339fa887ced5756d714e1a9fa01df09a1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?E=CC=81ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Tue, 2 May 2023 09:23:59 +0200 Subject: [PATCH] virtualenv --- manifest.toml | 2 +- scripts/install | 9 +++------ scripts/upgrade | 5 ++--- 3 files changed, 6 insertions(+), 10 deletions(-) diff --git a/manifest.toml b/manifest.toml index 07e70f6..fffc486 100644 --- a/manifest.toml +++ b/manifest.toml @@ -48,4 +48,4 @@ ram.runtime = "50M" [resources.ports] [resources.apt] - packages = "python3, python3-venv" + packages = "python3, python3-dev, python3-pip, virtualenv" diff --git a/scripts/install b/scripts/install index e784878..9b23881 100755 --- a/scripts/install +++ b/scripts/install @@ -21,15 +21,12 @@ chown -R $app:www-data "$install_dir" #================================================= # SPECIFIC SETUP #================================================= -ynh_script_progression --message="Installing dependencies..." --weight=2 - -ynh_exec_warn_less python3 -m pip install pipenv - ynh_script_progression --message="Installing LibreTranslate..." --weight=2 +ynh_exec_as $app virtualenv --python=python3 --system-site-packages "$install_dir/venv" + pushd $install_dir - mkdir -p .venv - PIPENV_VENV_IN_PROJECT="enabled" PIPENV_SKIP_LOCK=true ynh_exec_warn_less python3 -m pipenv install libretranslate==$libretranslate_version 2>&1 + ynh_exec_warn_less ynh_exec_as $app env PATH=$PATH pip install libretranslate==$libretranslate_version popd #================================================= diff --git a/scripts/upgrade b/scripts/upgrade index 9ef093e..a05afd2 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -38,11 +38,10 @@ chown -R $app:www-data "$install_dir" #================================================= ynh_script_progression --message="Installing LibreTranslate..." --weight=2 -ynh_exec_warn_less python3 -m pip install pipenv +ynh_exec_as $app virtualenv --python=python3 --system-site-packages "$install_dir/venv" pushd $install_dir - mkdir -p .venv - PIPENV_VENV_IN_PROJECT="enabled" PIPENV_SKIP_LOCK=true ynh_exec_warn_less python3 -m pipenv install libretranslate==$libretranslate_version 2>&1 + ynh_exec_warn_less ynh_exec_as $app env PATH=$PATH pip install libretranslate==$libretranslate_version popd #=================================================