Exemplo n.º 1
0
def main(args):
    parser = argparse.ArgumentParser(
        description = 'libgxps regression tests',
        prog = 'gxps-regtest',
        usage = '%(prog)s [options ...] command [command-options ...] tests',
        add_help = False)
    parser.add_argument('-h', '--help',
                        action = HelpAction, nargs = 0)
    parser.add_argument('--help-command', metavar = 'COMMAND',
                        action = HelpAction,
                        help = 'Show help for a given command')
    parser.add_argument('-v', '--verbose',
                        action = 'store_true', dest = 'verbose', default = False,
                        help = 'Run in verbose mode')
    parser.add_argument('--tools-dir',
                        action = 'store', dest = 'tools_dir', default = os.path.abspath("../tools"),
                        help = 'Directory of gxps tools used for the tests')
    parser.add_argument('--skip', metavar = 'FILE',
                        action = 'store', dest = 'skipped_file',
                        help = 'File containing tests to skip')

    ns, args = parser.parse_known_args(args)
    if not args:
        parser.print_help()
        sys.exit(0)

    Config(vars(ns))
    try:
        commands.run(args)
    except commands.UnknownCommandError:
        sys.stderr.write("Unknown command: %s\n" % (args[0]))
        commands.print_help()
        sys.exit(1)
Exemplo n.º 2
0
    def __call__(self, parser, namespace, values, option_string = None):
        if option_string == '--help-command':
            commands.run([values, '--help'])
            sys.exit(0)

        parser.print_help()
        commands.print_help()

        sys.exit(0)
Exemplo n.º 3
0
def main(args):
    n_cpus = cpu_count()

    parser = argparse.ArgumentParser(
        description = 'Poppler regression tests',
        prog = 'poppler-regtest',
        usage = '%(prog)s [options ...] command [command-options ...] tests',
        add_help = False)
    parser.add_argument('-h', '--help',
                        action = HelpAction, nargs = 0)
    parser.add_argument('--help-command', metavar = 'COMMAND',
                        action = HelpAction,
                        help = 'Show help for a given command')
    parser.add_argument('-v', '--verbose',
                        action = 'store_true', dest = 'verbose', default = False,
                        help = 'Run in verbose mode')
    parser.add_argument('--utils-dir',
                        action = 'store', dest = 'utils_dir', default = os.path.abspath("../utils"),
                        help = 'Directory of poppler utils used for the tests')
    parser.add_argument('-b', '--backends',
                        action = ListAction, dest = 'backends',
                        help = 'List of backends that will be used (separated by comma)')
    parser.add_argument('--skip', metavar = 'FILE',
                        action = 'store', dest = 'skipped_file',
                        help = 'File containing tests to skip')
    parser.add_argument('-p', '--passwords', metavar = 'FILE',
                        action = 'store', dest = 'passwords_file',
                        help = 'File containing the documents passwords')
    parser.add_argument('-t', '--threads',
                        action = 'store', dest = 'threads', type = int, default = n_cpus,
                        help = 'Number of worker threads (Default: %d)' % n_cpus)

    ns, args = parser.parse_known_args(args)
    if not args:
        parser.print_help()
        sys.exit(0)

    c = Config(vars(ns))

    if c.threads <= 0:
        c.threads = n_cpus - c.threads

    try:
        return commands.run(args)
    except commands.UnknownCommandError:
        sys.stderr.write("Unknown command: %s\n" % (args[0]))
        commands.print_help()
        return 1
    except backends.UnknownBackendError as e:
        sys.stderr.write(str(e) + "\n")
        sys.stdout.write("Backends are: %s\n" % (", ".join([backend.get_name() for backend in backends.get_all_backends()])))
        return 1
Exemplo n.º 4
0
def main(args):
    parser = argparse.ArgumentParser(
        description='Poppler regression tests',
        prog='poppler-regtest',
        usage='%(prog)s [options ...] command [command-options ...] tests',
        add_help=False)
    parser.add_argument('-h', '--help', action=HelpAction, nargs=0)
    parser.add_argument('--help-command',
                        metavar='COMMAND',
                        action=HelpAction,
                        help='Show help for a given command')
    parser.add_argument('--utils-dir',
                        action='store',
                        dest='utils_dir',
                        default=os.path.abspath("../utils"),
                        help='Directory of poppler utils used for the tests')
    parser.add_argument(
        '-b',
        '--backends',
        action=ListAction,
        dest='backends',
        help='List of backends that will be used (separated by comma)')
    parser.add_argument('--skip',
                        metavar='FILE',
                        action='store',
                        dest='skipped_file',
                        help='File containing tests to skip')

    ns, args = parser.parse_known_args(args)
    if not args:
        parser.print_help()
        sys.exit(0)

    Config(vars(ns))
    try:
        commands.run(args)
    except commands.UnknownCommandError:
        sys.stderr.write("Unknown command: %s\n" % (args[0]))
        commands.print_help()
        sys.exit(1)
    except backends.UnknownBackendError as e:
        sys.stderr.write(str(e) + "\n")
        sys.stdout.write("Backends are: %s\n" % (", ".join(
            [backend.get_name() for backend in backends.get_all_backends()])))
        sys.exit(1)
Exemplo n.º 5
0
def main(args):
    parser = argparse.ArgumentParser(
        description = 'Poppler regression tests',
        prog = 'poppler-regtest',
        usage = '%(prog)s [options ...] command [command-options ...] tests',
        add_help = False)
    parser.add_argument('-h', '--help',
                        action = HelpAction, nargs = 0)
    parser.add_argument('--help-command', metavar = 'COMMAND',
                        action = HelpAction,
                        help = 'Show help for a given command')
    parser.add_argument('--utils-dir',
                        action = 'store', dest = 'utils_dir', default = os.path.abspath("../utils"),
                        help = 'Directory of poppler utils used for the tests')
    parser.add_argument('-b', '--backends',
                        action = ListAction, dest = 'backends',
                        help = 'List of backends that will be used (separated by comma)')
    parser.add_argument('--skip', metavar = 'FILE',
                        action = 'store', dest = 'skipped_file',
                        help = 'File containing tests to skip')

    ns, args = parser.parse_known_args(args)
    if not args:
        parser.print_help()
        sys.exit(0)

    Config(vars(ns))
    try:
        commands.run(args)
    except commands.UnknownCommandError:
        sys.stderr.write("Unknown command: %s\n" % (args[0]))
        commands.print_help()
        sys.exit(1)
    except backends.UnknownBackendError as e:
        sys.stderr.write(str(e) + "\n")
        sys.stdout.write("Backends are: %s\n" % (", ".join([backend.get_name() for backend in backends.get_all_backends()])))
        sys.exit(1)
Exemplo n.º 6
0
def main(args):
    n_cpus = cpu_count()

    parser = argparse.ArgumentParser(
        description="Poppler regression tests",
        prog="poppler-regtest",
        usage="%(prog)s [options ...] command [command-options ...] tests",
        add_help=False,
    )
    parser.add_argument("-h", "--help", action=HelpAction, nargs=0)
    parser.add_argument("--help-command", metavar="COMMAND", action=HelpAction, help="Show help for a given command")
    parser.add_argument(
        "-v", "--verbose", action="store_true", dest="verbose", default=False, help="Run in verbose mode"
    )
    parser.add_argument(
        "--utils-dir",
        action="store",
        dest="utils_dir",
        default=os.path.abspath("../utils"),
        help="Directory of poppler utils used for the tests",
    )
    parser.add_argument(
        "-b",
        "--backends",
        action=ListAction,
        dest="backends",
        help="List of backends that will be used (separated by comma)",
    )
    parser.add_argument(
        "--skip", metavar="FILE", action="store", dest="skipped_file", help="File containing tests to skip"
    )
    parser.add_argument(
        "-t",
        "--threads",
        action="store",
        dest="threads",
        type=int,
        default=n_cpus,
        help="Number of worker threads (Default: %d)" % n_cpus,
    )

    ns, args = parser.parse_known_args(args)
    if not args:
        parser.print_help()
        sys.exit(0)

    c = Config(vars(ns))

    if c.threads <= 0:
        c.threads = n_cpus - c.threads

    try:
        commands.run(args)
    except commands.UnknownCommandError:
        sys.stderr.write("Unknown command: %s\n" % (args[0]))
        commands.print_help()
        sys.exit(1)
    except backends.UnknownBackendError as e:
        sys.stderr.write(str(e) + "\n")
        sys.stdout.write(
            "Backends are: %s\n" % (", ".join([backend.get_name() for backend in backends.get_all_backends()]))
        )
        sys.exit(1)