Example #1
0
def get_latest_version_content(server_url=DEFAULT_SERVER_URL):
    app_repo = AppRepository(server_url)

    plugin_repo = PluginRepository(server_url)

    plugin_info = OrderedDict(
        [
            (p, (plugin_repo.latest_version(p), plugin_repo.latest_package_url(p)))
            for p in plugin_repo.available_packages()
        ]
    )

    content = StringIO()

    # # Microdrop application #
    print >> content, "# Microdrop application installer #\n"

    app_info = (app_repo.latest_version("microdrop"), app_repo.latest_package_url("microdrop"))
    app_name = "microdrop"

    print >> content, " * [`%s` *(%s.%s.%s)*][%s]" % (
        app_name,
        app_info[0]["major"],
        app_info[0]["minor"],
        app_info[0]["micro"],
        app_name,
    )

    print >> content, "\n[%s]: %s%s" % (app_name, app_repo.server_url, app_info[1])

    print >> content, ""

    # # Microdrop plugins #
    print >> content, "# Plugins #\n"
    for name, info in plugin_info.iteritems():
        print >> content, " * [`%s` *(%s.%s.%s)*][%s]" % (
            name,
            info[0]["major"],
            info[0]["minor"],
            info[0]["micro"],
            name,
        )
    print >> content, ""
    for name, info in plugin_info.iteritems():
        print >> content, "[%s]: %s%s" % (name, plugin_repo.server_url, info[1])

    return content.getvalue()
Example #2
0
def get_latest_version_content(server_url=DEFAULT_SERVER_URL):
    app_repo = AppRepository(server_url)

    plugin_repo = PluginRepository(server_url)

    plugin_info = OrderedDict([(p, (plugin_repo.latest_version(p),
                                    plugin_repo.latest_package_url(p)))
                               for p in plugin_repo.available_packages()])

    content = StringIO()

    # # MicroDrop application #
    print >> content, '# MicroDrop application installer #\n'

    app_info = (app_repo.latest_version('microdrop'),
                app_repo.latest_package_url('microdrop'))
    app_name = 'microdrop'

    print >> content, ' * [`%s` *(%s.%s.%s)*][%s]' % (app_name,
                                                      app_info[0]['major'],
                                                      app_info[0]['minor'],
                                                      app_info[0]['micro'],
                                                      app_name)

    print >> content, '\n[%s]: %s%s' % (app_name, app_repo.server_url,
                                        app_info[1])

    print >> content, ''

    # # MicroDrop plugins #
    print >> content, '# Plugins #\n'
    for name, info in plugin_info.iteritems():
        print >> content, ' * [`%s` *(%s.%s.%s)*][%s]' % (name,
                                                          info[0]['major'],
                                                          info[0]['minor'],
                                                          info[0]['micro'],
                                                          name)
    print >> content, ''
    for name, info in plugin_info.iteritems():
        print >> content, '[%s]: %s%s' % (name, plugin_repo.server_url,
                                          info[1])

    return content.getvalue()
Example #3
0
    def update_check(self):
        if self._update_setting() not in ('auto-update',
                                          'check for updates, but ask before '
                                          'installing'):
            return

        app_update_server_url = self.config.data.get(self.name, {}).get(
                'server_url', 'http://microfluidics.utoronto.ca/update')
        logger.debug('[APP UPDATE SERVER] server url: %s' % app_update_server_url)
        app_repository = AppRepository(app_update_server_url)
        current_version = Version.fromstring(self.version)
        try:
            latest_version = Version(**app_repository.latest_version('microdrop'))
        except (JSONRPCException, JSONDecodeException, IOError):
            logger.warning('Could not connect to application update server: '
                           '%s', app_update_server_url)
            return
        if current_version < latest_version:
            logger.info('Current version: %s. There is a new version '
                        'available: %s %s' % (current_version, latest_version,
                                               app_repository.server_url +
                                               app_repository
                                               .latest_package_url(
                                                   'microdrop')))
            response = yesno('''
There is a new version of Microdrop available (%s, current version: %s).

Would you like to download the latest version in your browser?''' %
                             (latest_version, current_version))
            if response == gtk.RESPONSE_YES:
                latest_full_url = (app_repository.server_url + app_repository
                                   .latest_package_url('microdrop'))
                if webbrowser.open_new_tab(latest_full_url):
                    logger.info('Closing app after opening browser to latest '
                                'version (%s).' % latest_version)
                    try:
                        self.main_window_controller.on_destroy(None)
                    except AttributeError:
                        raise SystemExit, 'Closing app to allow upgrade installation'
        else:
            logger.info('[SUCCESS] software is up-to-date.\n (installed '
                        'version: %s, server version: %s)' % (current_version,
                                                              latest_version))
Example #4
0
def get_latest_version_content(server_url=DEFAULT_SERVER_URL):
    app_repo = AppRepository(server_url)

    plugin_repo = PluginRepository(server_url)

    plugin_info = OrderedDict([(p, (plugin_repo.latest_version(p),
                                    plugin_repo.latest_package_url(p)))
                               for p in plugin_repo.available_packages()])

    content = StringIO()

    # # MicroDrop application #
    print >> content, '# MicroDrop application installer #\n'

    app_info = (app_repo.latest_version('microdrop'),
                app_repo.latest_package_url('microdrop'))
    app_name = 'microdrop'

    print >> content, ' * [`%s` *(%s.%s.%s)*][%s]' % (
        app_name, app_info[0]['major'], app_info[0]['minor'],
        app_info[0]['micro'], app_name)

    print >> content, '\n[%s]: %s%s' % (app_name, app_repo.server_url,
                                        app_info[1])

    print >> content, ''

    # # MicroDrop plugins #
    print >> content, '# Plugins #\n'
    for name, info in plugin_info.iteritems():
        print >> content, ' * [`%s` *(%s.%s.%s)*][%s]' % (
            name, info[0]['major'], info[0]['minor'], info[0]['micro'], name)
    print >> content, ''
    for name, info in plugin_info.iteritems():
        print >> content, '[%s]: %s%s' % (name, plugin_repo.server_url,
                                          info[1])

    return content.getvalue()