예제 #1
0
    def __init__(self,
                 version_finder=None,
                 esky_app=None,
                 local_update_site=False):

        if esky_app is not None:
            self.esky_app = esky_app
        elif not hasattr(sys, 'frozen'):
            raise AppNotFrozen("Application is not frozen, cannot build Esky"
                               " instance, as a consequence update features"
                               " won't be available")
        elif version_finder is None:
            raise UpdaterInitError("Cannot initialize Esky instance with no"
                                   " version finder, as a consequence update"
                                   " features won't be available")
        else:
            try:
                executable = sys.executable
                log.debug(
                    "Application is frozen, building Esky instance from"
                    " executable %s and version finder %s", executable,
                    version_finder)
                self.esky_app = Esky(executable, version_finder=version_finder)
            except EskyBrokenError as e:
                log.error(e, exc_info=True)
                raise UpdaterInitError("Error initializing Esky instance, as a"
                                       " consequence update features won't be"
                                       " available")
        self.local_update_site = local_update_site
        self.update_site = self.esky_app.version_finder.download_url
        if not self.local_update_site and not self.update_site.endswith('/'):
            self.update_site = self.update_site + '/'
예제 #2
0
 def __init__(self,
              manager,
              version_finder=None,
              check_interval=DEFAULT_UPDATE_CHECK_DELAY,
              esky_app=None,
              local_update_site=False):
     super(AppUpdater, self).__init__(check_interval)
     self.refreshStatus.connect(self._poll)
     self._doUpdate.connect(self._update)
     self._manager = manager
     self._enable = False
     if esky_app is not None:
         self.esky_app = esky_app
         self._enable = True
     elif not hasattr(sys, 'frozen'):
         log.debug("Application is not frozen, cannot build Esky"
                   " instance, as a consequence update features"
                   " won't be available")
     elif version_finder is None:
         log.debug("Cannot initialize Esky instance with no"
                   " version finder, as a consequence update"
                   " features won't be available")
     else:
         try:
             executable = sys.executable
             log.debug(
                 "Application is frozen, building Esky instance from"
                 " executable %s and version finder %s", executable,
                 version_finder)
             self.esky_app = Esky(executable, version_finder=version_finder)
             self._enable = True
         except EskyBrokenError as e:
             log.error(e, exc_info=True)
             log.debug("Error initializing Esky instance, as a"
                       " consequence update features won't be"
                       " available")
     self.local_update_site = local_update_site
     if self._enable:
         self.update_site = self.esky_app.version_finder.download_url
         if not self.local_update_site and not self.update_site.endswith(
                 '/'):
             self.update_site = self.update_site + '/'
     self.last_status = (UPDATE_STATUS_UP_TO_DATE, None)