From fe71170644ce801bace92f5011b41512e74918b2 Mon Sep 17 00:00:00 2001 From: Jean-Baptiste Holcroft Date: Thu, 28 Dec 2017 08:04:17 +0100 Subject: [PATCH] Improve upgrade --- check_process | 2 -- scripts/upgrade | 35 +++++++++++++++++++++++------------ 2 files changed, 23 insertions(+), 14 deletions(-) diff --git a/check_process b/check_process index 5337af0..97a4fbd 100644 --- a/check_process +++ b/check_process @@ -20,8 +20,6 @@ setup_private=1 setup_public=1 upgrade=1 - # latest published github - upgrade=1 from_commit=5d0b16f4cd458cc5c93f8a3287aa9560738c08fb # latest published in community.json upgrade=1 from_commit=58c98267fa4c3ea5c1ff8fd4c63655a3230a2134 backup_restore=1 diff --git a/scripts/upgrade b/scripts/upgrade index cb5519b..1eef08d 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -28,17 +28,6 @@ memc_port=$(ynh_app_setting_get "$app" memc_port) github_account=$(ynh_app_setting_get "$app" github_account) key=$(ynh_string_random) -settings="$final_path/venv/lib/python2.7/site-packages/weblate/settings.py" - -#save memc_port if it doesn't exist -if [[ -z "$memc_port" ]] -then - memc_port=$(cat "$settings" \ - | grep "'LOCATION': '127.0.0.1:" \ - | sed "s|.*:\\(.*\\)'.*|\\1|") - ynh_app_setting_set "$app" memc_port "$memc_port" -fi - #================================================= # Get previous version number #================================================= @@ -55,6 +44,28 @@ previous_version=$(cat freeze.pip | grep "Weblate==" | sed "s|Weblate==||") previous_version_file="../conf/settings_history/settings.$previous_version.py" test -e "$previous_version_file" || ynh_die "Previous version unknown: $previous_version" +case "$previous_version" in + +2.16) python_ver=2.7 + ;; +2.17.1) python_ver=2.7 + ;; +*) python_ver=3.4 + ;; +esac + +settings="$final_path/venv/lib/python2.7/site-packages/weblate/settings.py" + +#save memc_port if it doesn't exist +if [[ -z "$memc_port" ]] +then + memc_port=$(cat "$settings" \ + | grep "'LOCATION': '127.0.0.1:" \ + | sed "s|.*:\\(.*\\)'.*|\\1|") + ynh_app_setting_set "$app" memc_port "$memc_port" +fi + + #================================================= # ENSURE DOWNWARD COMPATIBILITY #================================================= @@ -138,7 +149,7 @@ settings_diff="$final_path/settings.${previous_version}_${current_version}.diff" source "${final_path}/venv/bin/activate" set -o nounset pip install Weblate=="$current_version" - pip install pytz python-bidi PyYaML Babel pyuca pylibravatar pydns psycopg2 python-memcached + pip install python-bidi PyYaML Babel pyuca pylibravatar py3dns psycopg2 python-memcached # specific to YunoHost package: pip install django_sendmail_backend )