From f2a1b35bfb2c06c2b0c5c4d9f9133a830989b293 Mon Sep 17 00:00:00 2001 From: Jerome Lebleu Date: Thu, 19 Dec 2013 17:31:29 +0100 Subject: [PATCH] Change min_version check and remove temp file --- yunohost_app.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/yunohost_app.py b/yunohost_app.py index 0f7697f9..24a7299d 100644 --- a/yunohost_app.py +++ b/yunohost_app.py @@ -82,6 +82,7 @@ def app_fetchlist(url=None, name=None): list_file = repo_path +'/'+ name +'.json' if os.system('wget "'+ url +'" -O "'+ list_file +'.tmp"') != 0: + os.remove(list_file +'.tmp') raise YunoHostError(1, _("List server connection failed")) # Rename fetched temp list @@ -312,7 +313,7 @@ def app_upgrade(app, url=None, file=None): # Check min version if 'min_version' in manifest and __version__ < manifest['min_version']: - raise YunoHostError(1, app_id + _(" requires a more recent version of the moulinette")) + raise YunoHostError(1, _("%s requires a more recent version of the moulinette") % app_id) app_setting_path = apps_setting_path +'/'+ app_id @@ -388,16 +389,16 @@ def app_install(app, label=None, args=None): else: manifest = _extract_app_from_file(app) - # Check min version - if 'min_version' in manifest and __version__ < manifest['min_version']: - raise YunoHostError(1, _("App requires a more recent version of the moulinette")) - # Check ID if 'id' not in manifest or '__' in manifest['id']: raise YunoHostError(22, _("App id is invalid")) app_id = manifest['id'] + # Check min version + if 'min_version' in manifest and __version__ < manifest['min_version']: + raise YunoHostError(1, _("%s requires a more recent version of the moulinette") % app_id) + # Check if app can be forked instance_number = _installed_instance_number(app_id, last=True) + 1 if instance_number > 1 :