コード例 #1
0
 def change_slug(self, old_slug, new_slug):
     if old_slug is not None and new_slug is not None:
         try:
             game = self._slugs[old_slug]
             del(self._slugs[old_slug])
             if new_slug in self._slugs.keys():
                 new_slug = SlugDetail(self.make_slug_unique(new_slug))
                 game.slug = new_slug
             self._slugs[new_slug] = game
         except KeyError:
             LOG.error('Error swapping slugs:' + old_slug + ' for ' + new_slug)
         else:
             MetricsSession.rename(old_slug, new_slug)
             cache_dir = config.get('deploy.cache_dir', None)
             Deployment.rename_cache(cache_dir, old_slug, new_slug)
コード例 #2
0
 def change_slug(self, old_slug, new_slug):
     if old_slug is not None and new_slug is not None:
         try:
             game = self._slugs[old_slug]
             del (self._slugs[old_slug])
             if new_slug in self._slugs.keys():
                 new_slug = SlugDetail(self.make_slug_unique(new_slug))
                 game.slug = new_slug
             self._slugs[new_slug] = game
         except KeyError:
             LOG.error('Error swapping slugs:' + old_slug + ' for ' +
                       new_slug)
         else:
             MetricsSession.rename(old_slug, new_slug)
             cache_dir = config.get('deploy.cache_dir', None)
             Deployment.rename_cache(cache_dir, old_slug, new_slug)
コード例 #3
0
    def _create_deploy_info(cls, game, hub_project, hub_version,
                            hub_versiontitle, hub_cookie):

        deploy_info = Deployment(game, cls.hub_pool, hub_project, hub_version,
                                 hub_versiontitle, hub_cookie, cls.cache_dir)

        thread = Thread(target=deploy_info.deploy, args=[])
        thread.daemon = True
        thread.start()

        deploy_key = hub_project + hub_version
        cls._deploying[deploy_key] = deploy_info
コード例 #4
0
def main():
    # pylint: disable=E1103

    options = _check_options()

    locale.setlocale(locale.LC_ALL, '')

    verbose = options.verbose

    if verbose:
        logging.disable(logging.INFO)
    else:
        logging.disable(logging.WARNING)

    _add_missing_mime_types()

    try:
        game = Game(game_list=None,
                    game_path=path_abspath(path_dirname(options.input)),
                    slug=None,
                    games_root=options.cache,
                    deploy_enable=True,
                    manifest_name=path_basename(options.input))

        _check_game(game)

        silent = options.silent
        if not silent:
            log('Deploying "%s" to "%s".' % (game.slug, options.hub))

        connection = connection_from_url(options.hub, maxsize=8, timeout=8.0)

        cookie = login(connection, options)

        (project, projectversion,
         projectversion_title) = _check_project(connection, options, cookie)

        result = 0

        deploy_info = None
        deploy_thread = None

        try:
            deploy_info = Deployment(game, connection, project, projectversion,
                                     projectversion_title,
                                     _get_cookie_value(cookie), options.cache)

            deploy_thread = Thread(target=deploy_info.deploy,
                                   args=[options.ultra])
            deploy_thread.start()

            start_time = time()

            result = _progress(deploy_info, silent, verbose)
            if (0 == result):
                result = _postupload_progress(deploy_info, connection, cookie,
                                              silent, verbose)
                if (0 == result):
                    if not silent:
                        log('Deployment time: %s' % _fmt_time(
                            (time() - start_time)))
                    game.set_deployed()

        except KeyboardInterrupt:
            warning('Program stopped by user!')
            if deploy_info:
                deploy_info.cancel()
            result = -1

        except Exception as e:
            error(str(e))
            if deploy_info:
                deploy_info.cancel()
            result = -1

        if deploy_info:
            del deploy_info

        if deploy_thread:
            del deploy_thread

        logout(connection, cookie)

        return result

    except GameError:
        return -1
コード例 #5
0
def main():
    # pylint: disable=E1103

    options = _check_options()

    locale.setlocale(locale.LC_ALL, '')

    verbose = options.verbose

    if verbose:
        logging.disable(logging.INFO)
    else:
        logging.disable(logging.WARNING)

    _add_missing_mime_types()

    try:
        game = Game(game_list=None,
                    game_path=path_abspath(path_dirname(options.input)),
                    slug=None,
                    games_root=options.cache,
                    deploy_enable=True,
                    manifest_name=path_basename(options.input))

        _check_game(game)

        silent = options.silent
        if not silent:
            log('Deploying "%s" to "%s".' % (game.slug, options.hub))

        connection = connection_from_url(options.hub, maxsize=8, timeout=8.0)

        cookie = login(connection, options)

        (project, projectversion, projectversion_title) = _check_project(connection, options, cookie)

        result = 0

        deploy_info = None
        deploy_thread = None

        try:
            deploy_info = Deployment(game,
                                     connection,
                                     project,
                                     projectversion,
                                     projectversion_title,
                                     _get_cookie_value(cookie),
                                     options.cache)

            deploy_thread = Thread(target=deploy_info.deploy, args=[options.ultra])
            deploy_thread.start()

            start_time = clock()

            result = _progress(deploy_info, silent, verbose)
            if (0 == result):
                result = _postupload_progress(deploy_info, connection, cookie, silent, verbose)
                if (0 == result):
                    if not silent:
                        log('Deployment time: %s' % _fmt_time((clock() - start_time)))
                    game.set_deployed()

        except KeyboardInterrupt:
            warning('Program stopped by user!')
            if deploy_info:
                deploy_info.cancel()
            result = -1

        except Exception as e:
            error(str(e))
            if deploy_info:
                deploy_info.cancel()
            result = -1

        if deploy_info:
            del deploy_info

        if deploy_thread:
            del deploy_thread

        logout(connection, cookie)

        return result

    except GameError:
        return -1