def main(): types = ["all"] + list(ExternalData.TYPES) parser = argparse.ArgumentParser() parser.add_argument("manifest", help="Flatpak manifest to check", type=os.path.abspath) parser.add_argument("-v", "--verbose", help="Print debug messages", action="store_true") parser.add_argument( "--update", help="Update manifest(s) to refer to new versions of " "external data - also open PRs for changes unless " "--commit-only is specified", action="store_true", ) parser.add_argument( "--commit-only", help="Do not open PRs for updates, only commit changes " "to external data (implies --update)", action="store_true", ) parser.add_argument( "--filter-type", help="Only check external data of the given type", choices=types, default="all", ) args = parser.parse_args() init_logging(logging.DEBUG if args.verbose else logging.INFO) manifest_checker = checker.ManifestChecker(args.manifest) filter_type = ExternalData.TYPES.get(args.filter_type) manifest_checker.check(filter_type) if print_outdated_external_data(manifest_checker): if args.update or args.commit_only: changes = manifest_checker.update_manifests() if changes: with indir(os.path.dirname(args.manifest)): subject, body, branch = commit_changes(changes) if not args.commit_only: open_pr(subject, body, branch, manifest_checker=manifest_checker) return log.warning("Can't automatically fix any of the above issues") sys.exit(1)
def setUp(self): init_logging()
def setUp(self): init_logging(logging.INFO)