Ejemplo n.º 1
0
    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()
Ejemplo n.º 2
0
 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()
Ejemplo n.º 3
0
 def getSelfUpdaterAsset(self):
     """Get asset corresponding with application upgrade (if exist)."""
     if config.assetupd and utils.getCurrentVersion():
         return self.getAsset(config.assetupd)
Ejemplo n.º 4
0
 def localVersion(self):
     """Same as application version."""
     return utils.getCurrentVersion()
Ejemplo n.º 5
0
 def hasRemoteUpdate(self):
     cur = utils.getCurrentVersion()
     return cur and self.isRemote() and self.remoteVersion() > cur
Ejemplo n.º 6
0
 def hasLocalUpdate(self):
     cur = utils.getCurrentVersion()
     return cur and self.isLocal() and self.localVersion() > cur