def _get_extensions_manager(extensions, hard_order=False): try: printdbg("Starting ExtensionsManager") emg = ExtensionsManager(extensions, hard_order=hard_order) return emg except InvalidExtension, e: printerr("Invalid extension %s", (e.name, )) sys.exit(1)
metrics_all = None metrics_noerr = None gitref = None try: opts, args = getopt.getopt(argv, short_opts, long_opts) except getopt.GetoptError, e: printerr(str(e)) return 1 for opt, value in opts: if opt in ("-h", "--help", "-help"): usage() return 0 elif opt in ("-e", "--list-extensions"): emg = ExtensionsManager([]) allExtensions = emg.load_all_extensions() print ", ".join(sorted(allExtensions)) return 0 elif opt in ("-V", "--version"): print VERSION return 0 elif opt in ("--debug", "-g"): debug = True elif opt in ("--quiet", "-q"): quiet = True elif opt in ("--profile", ): profile = True elif opt in ("--no-parse", "-n"): no_parse = True elif opt in ("-f", "--config-file"):
if config.repo_logfile is not None: parser = create_parser_from_logfile (config.repo_logfile) reader.set_logfile (config.repo_logfile) else: parser = create_parser_from_repository (repo) parser.set_repository (repo, uri) if parser is None: printerr ("Failed to create parser") return 1 # TODO: check parser type == logfile type try: emg = ExtensionsManager (config.extensions) except InvalidExtension, e: printerr ("Invalid extension %s", (e.name,)) return 1 except InvalidDependency, e: printerr ("Extension %s depends on extension %s which is not a valid extension", (e.name1, e.name2)) return 1 except Exception, e: printerr ("Unknown extensions error: %s", (str (e),)) return 1 db_exists = False try: db = create_database (config.db_driver, config.db_database,
if config.repo_logfile is not None: parser = create_parser_from_logfile(config.repo_logfile) reader.set_logfile(config.repo_logfile) else: parser = create_parser_from_repository(repo) parser.set_repository(repo, uri) if parser is None: printerr("Failed to create parser") return 1 # TODO: check parser type == logfile type try: emg = ExtensionsManager(config.extensions, hard_order=config.hard_order) except InvalidExtension, e: printerr("Invalid extension %s", (e.name, )) return 1 except InvalidDependency, e: printerr( "Extension %s depends on extension %s which is not a valid extension", (e.name1, e.name2)) return 1 except Exception, e: printerr("Unknown extensions error: %s", (str(e), )) return 1 db_exists = False try: