From f736a15c12b83347ec39bc37691aa376cad0fcc1 Mon Sep 17 00:00:00 2001 From: Ozzieisaacs Date: Sun, 2 Jun 2019 18:43:09 +0200 Subject: [PATCH] Fix for restart of newer versions of tornado during update Fix for updater with Beta Versions --- cps/server.py | 9 +++++---- cps/updater.py | 21 ++++++++++++++------- 2 files changed, 19 insertions(+), 11 deletions(-) diff --git a/cps/server.py b/cps/server.py index 0531a729..98baddf3 100644 --- a/cps/server.py +++ b/cps/server.py @@ -103,6 +103,7 @@ class server: ssl_options=ssl) http_server.listen(web.ub.config.config_port) self.wsgiserver=IOLoop.instance() + web.py3_gevent_link = self.wsgiserver self.wsgiserver.start() # wait for stop signal self.wsgiserver.close(True) @@ -142,10 +143,10 @@ class server: # ToDo: Somehow caused by circular import under python3 refactor if sys.version_info > (3, 0): if not self.wsgiserver: - if gevent_present: - self.wsgiserver = web.py3_gevent_link - else: - self.wsgiserver = IOLoop.instance() + # if gevent_present: + self.wsgiserver = web.py3_gevent_link + #else: + # self.wsgiserver = IOLoop.instance() if self.wsgiserver: if gevent_present: self.wsgiserver.close() diff --git a/cps/updater.py b/cps/updater.py index b2e5af09..7592b326 100644 --- a/cps/updater.py +++ b/cps/updater.py @@ -426,18 +426,25 @@ class Updater(threading.Thread): minor_version_update = int(commit[i]['tag_name'].split('.')[1]) patch_version_update = int(commit[i]['tag_name'].split('.')[2]) + current_version[0] = int(current_version[0]) + current_version[1] = int(current_version[1]) + try: + current_version[2] = int(current_version[2]) + except ValueError: + current_version[2] = int(current_version[2].split(' ')[0])-1 + # Check if major versions are identical search for newest nonenqual commit and update to this one - if major_version_update == int(current_version[0]): - if (minor_version_update == int(current_version[1]) and - patch_version_update > int(current_version[2])) or \ - minor_version_update > int(current_version[1]): + if major_version_update == current_version[0]: + if (minor_version_update == current_version[1] and + patch_version_update > current_version[2]) or \ + minor_version_update > current_version[1]: parents.append([commit[i]['tag_name'],commit[i]['body'].replace('\r\n', '

')]) i -= 1 continue - if major_version_update < int(current_version[0]): + if major_version_update < current_version[0]: i -= 1 continue - if major_version_update > int(current_version[0]): + if major_version_update > current_version[0]: # found update update to last version before major update, unless current version is on last version # before major update if commit[i+1]['tag_name'].split('.')[1] == current_version[1]: @@ -466,7 +473,7 @@ class Updater(threading.Thread): 'update': True, 'success': True, 'message': _( - u'A new update is available. Click on the button below to update to the latest version.'), + u'Click on the button below to update to the latest stable version.'), 'history': parents }) self.updateFile = commit[0]['zipball_url']