async def runAutoUpdater(self): try: updAsset = self.mgr.getSelfUpdaterAsset() updater = updAsset and updAsset.getUpdater() cur = utils.getCurrentVersion() if updater and cur: loc = updAsset.localVersion(None) rem = updAsset.remoteVersion(None) if (loc and cur >= loc) or (loc and rem and rem > loc): updAsset.removeLocal() loc = None if rem and not loc and rem > cur: logger.info('new version available to download, %s -> %s', utils.versionToString(cur), utils.versionToString(rem)) updater.start() except asyncio.CancelledError: raise except Exception as e: logger.error('update processing failed: %r', e, exc_info=True) self.error = sys.exc_info()
def removeOldInstaller(self): cur = utils.getCurrentVersion() if cur: updAsset = self.mgr.getSelfUpdaterAsset() if updAsset: loc = updAsset.localVersion(None) rem = updAsset.remoteVersion(None) if loc and loc <= cur: updAsset.removeLocal() elif loc and rem and loc < rem: updAsset.removeLocal()
def getSelfUpdaterAsset(self): """Get asset corresponding with application upgrade (if exist).""" if config.assetupd and utils.getCurrentVersion(): return self.getAsset(config.assetupd)
def localVersion(self): """Same as application version.""" return utils.getCurrentVersion()
def hasRemoteUpdate(self): cur = utils.getCurrentVersion() return cur and self.isRemote() and self.remoteVersion() > cur
def hasLocalUpdate(self): cur = utils.getCurrentVersion() return cur and self.isLocal() and self.localVersion() > cur