From 19bede5ab07538a1f0b1bde5177aadbef3a304a9 Mon Sep 17 00:00:00 2001 From: Jocelyn Delalande Date: Thu, 20 Dec 2018 08:07:30 +0100 Subject: [PATCH] Factorize pip stuff between install and upgrade --- scripts/_common.sh | 8 ++++++++ scripts/install | 5 +---- scripts/upgrade | 3 +-- 3 files changed, 10 insertions(+), 6 deletions(-) diff --git a/scripts/_common.sh b/scripts/_common.sh index da9bbcc..7f8eda6 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -40,6 +40,14 @@ init_virtualenv () { /opt/yunohost/ihatemoney/venv/bin/pip install 'setuptools>=18.5' } +pip_install () { + sudo /opt/yunohost/ihatemoney/venv/bin/pip install --upgrade \ + 'gunicorn>=19.3.0' \ + 'PyMySQL>=0.9,<0.10' \ + 'ihatemoney>=3,<4' \ + +} + configure_nginx () { local domain=$1 local path=$2 diff --git a/scripts/install b/scripts/install index c7ab888..b6f8061 100755 --- a/scripts/install +++ b/scripts/install @@ -43,10 +43,7 @@ create_unix_user # Prepare venv init_virtualenv -sudo /opt/yunohost/ihatemoney/venv/bin/pip install \ - 'gunicorn>=19.3.0' \ - 'PyMySQL>=0.9,<0.10' \ - 'ihatemoney>=3,<4' \ +pip_install create_system_dirs diff --git a/scripts/upgrade b/scripts/upgrade index 16c9dcf..474d852 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -9,7 +9,6 @@ app=$YNH_APP_INSTANCE_NAME # Installation paths INSTALL_DIR=/opt/yunohost/ihatemoney -PIP=${INSTALL_DIR}/venv/bin/pip # Source YunoHost helpers . /usr/share/yunohost/helpers @@ -85,7 +84,7 @@ fi # Upgrade code and dependencies -sudo ${PIP} install --upgrade 'gunicorn>=19.3.0' PyMySQL 'ihatemoney>=3,<4' +pip_install #-----------------------POST-UPGRADE MIGRATIONS-----------------