Beispiel #1
0
def parse_args() -> (list, bool):
    """
    Creates a parser for command lines attributes and parses them
    :return: the programs to install and Force
    """
    parser = ArgumentParser(
        description="An automated install script for our Benchmarks",
        parents=[arguments.get_verbosity_parser()])
    parser.add_argument("-f",
                        "--force",
                        help="Force reinstall if already installed",
                        action="store_true",
                        dest="force_installation")
    parser.add_argument(
        "programs",
        nargs="+",
        type=str,
        help="the programs you want to install. Must be in : {} or all.".
        format(" ".join(PROGRAMS)))

    # pylint: disable=no-member
    parser.add_argument(
        "-p",
        "--processes",
        type=int,
        default=multiprocessing.cpu_count(),
        help="the number of process the script can use to build. Default : {}".
        format(multiprocessing.cpu_count()))

    hooks.register_for_install(parser=parser)

    args = parser.parse_args()

    logging.getLogger().setLevel(args.logging_level)

    _programs = args.programs
    if "all" in _programs:
        args.programs = PROGRAMS
    else:
        for _ in _programs:
            if _ not in PROGRAMS:
                parser.print_help()
                exit(1)

    return vars(args)
Beispiel #2
0
def parse_args() -> (list, bool):
    """
    Creates a parser for command lines attributes and parses them
    :return: the programs to install and Force
    """
    parser = ArgumentParser(
        description="An automated install script for our Benchmarks", parents=[arguments.get_verbosity_parser()]
    )
    parser.add_argument(
        "-f", "--force", help="Force reinstall if already installed", action="store_true", dest="force_installation"
    )
    parser.add_argument(
        "programs",
        nargs="+",
        type=str,
        help="the programs you want to install. Must be in : {} or all.".format(" ".join(PROGRAMS)),
    )

    # pylint: disable=no-member
    parser.add_argument(
        "-p",
        "--processes",
        type=int,
        default=multiprocessing.cpu_count(),
        help="the number of process the script can use to build. Default : {}".format(multiprocessing.cpu_count()),
    )

    hooks.register_for_install(parser=parser)

    args = parser.parse_args()

    logging.getLogger().setLevel(args.logging_level)

    _programs = args.programs
    if "all" in _programs:
        args.programs = PROGRAMS
    else:
        for _ in _programs:
            if _ not in PROGRAMS:
                parser.print_help()
                exit(1)

    return vars(args)
Beispiel #3
0
def parse_args() -> tuple:
    """
    Creates a parser for command lines attributes and parses them
    :return: True if the program is to run interactively
    """
    parser = ArgumentParser(
        description="An automated configure script for Bugbase usage", parents=[arguments.get_verbosity_parser()]
    )
    parser.add_argument(
        "--default", help="use default values and don't ask anything (non-interactive mode)",
        action="store_false", dest="interactive"
    )
    parser.add_argument(
        "-f", "--force", help="Force reinstall of all programs if used",
        action="store_true", dest="force"
    )

    args = parser.parse_args()

    logging.getLogger().setLevel(args.logging_level)

    return args.interactive, args.force
Beispiel #4
0
def parse_args(args: list) -> dict:
    """
    Create a parser for command line attributes and parses them
    :param args: the arguments to parse
    :return: parsed arguments
    """
    parser = SmartArgumentParser(
        description="Triggers some bug in listed programs", parents=[arguments.get_verbosity_parser()]
    )
    plugin_parser = parser.add_subparsers(metavar="plugin")
    parser.add_argument(
        "bugs",
        nargs="+",
        type=str,
        help="one of {} or all".format(", ".join(PROGRAMS)),
        metavar="bug",
        choices=PROGRAMS + ["all"],
    )

    register_for_trigger(parser=parser, subparser=plugin_parser)

    parsed_args = parser.parse_args(args)

    # noinspection PyUnresolvedReferences
    logging.getLogger().setLevel(parsed_args.logging_level)

    _bugs = parsed_args.bugs
    if "all" in _bugs:
        parsed_args.bugs = [
            program for program in PROGRAMS if os.path.exists(get_trigger_conf(program).get("install_directory"))
        ]
    else:
        for _ in _bugs:
            if _ not in PROGRAMS:
                parser.print_help()
                exit(PROGRAM_ARGUMENT_ERROR)

    return vars(parsed_args)
Beispiel #5
0
def parse_args(args: list) -> dict:
    """
    Create a parser for command line attributes and parses them
    :param args: the arguments to parse
    :return: parsed arguments
    """
    parser = SmartArgumentParser(
        description="Triggers some bug in listed programs",
        parents=[arguments.get_verbosity_parser()])
    plugin_parser = parser.add_subparsers(metavar="plugin")
    parser.add_argument("bugs",
                        nargs="+",
                        type=str,
                        help="one of {} or all".format(", ".join(PROGRAMS)),
                        metavar="bug",
                        choices=PROGRAMS + ["all"])

    register_for_trigger(parser=parser, subparser=plugin_parser)

    parsed_args = parser.parse_args(args)

    # noinspection PyUnresolvedReferences
    logging.getLogger().setLevel(parsed_args.logging_level)

    _bugs = parsed_args.bugs
    if "all" in _bugs:
        parsed_args.bugs = [
            program for program in PROGRAMS if os.path.exists(
                get_trigger_conf(program).get("install_directory"))
        ]
    else:
        for _ in _bugs:
            if _ not in PROGRAMS:
                parser.print_help()
                exit(PROGRAM_ARGUMENT_ERROR)

    return vars(parsed_args)
Beispiel #6
0
def parse_args() -> tuple:
    """
    Creates a parser for command lines attributes and parses them
    :return: True if the program is to run interactively
    """
    parser = ArgumentParser(
        description="An automated configure script for Bugbase usage",
        parents=[arguments.get_verbosity_parser()])
    parser.add_argument(
        "--default",
        help="use default values and don't ask anything (non-interactive mode)",
        action="store_false",
        dest="interactive")
    parser.add_argument("-f",
                        "--force",
                        help="Force reinstall of all programs if used",
                        action="store_true",
                        dest="force")

    args = parser.parse_args()

    logging.getLogger().setLevel(args.logging_level)

    return args.interactive, args.force