def check_for_updates(): """ Check and return available updates. Honour the frequency of update checking unless force is True. Return list of pair (version, description), where description is an html-formatted text. Raise an exception if anything goes wrong. """ if( force or preferences.updateLastCheck is None or datetime.datetime.now() > preferences.updateLastCheck + datetime.timedelta(days=preferences.updateFrequency) ): tr = ProxyTransport() s = Server(preferences.updateUrl, transport = tr) # method returns a dictionary with those keys: # 'new_url': if defined, new url of the webservice # 'updates': list of 3-tuples (version, description, downloadUrl) u = s.checkForUpdates( glb.VERSION, preferences.updateFrequency, platform.system(), platform.architecture(), platform.platform(), platform.python_version(), wx.version(), i18n.getLang(), ) u2 = [x for x in u['updates'] if x[0] not in preferences.ignoredUpdates] preferences.updateLastCheck = datetime.datetime.now() if 'new_url' in u: preferences.updateUrl = u['new_url'] return u2 return []