def argument_preprocessor(self, args): # The CMake pass-through flag collects dashed options. # This requires special handling or argparse will complain about # unrecognized options. args, cmake_args = extract_argument_group(args, '--cmake-args') args, ctest_args = extract_argument_group(args, '--ctest-args') extras = { 'cmake_args': cmake_args, 'ctest_args': ctest_args, } return args, extras
def argument_preprocessor(args): """ Run verb and build_type plugin preprocessors on arguments. The preprocessors take in raw arguments and return potentially trimmed arguments and extra options to be added to the argparse NameSpace object. :param list args: list of arguments as str's :returns: tuple of left over arguments and dictionary of extra options :raises: SystemError if underlying assumptions are not met """ extras = {} # Extract make arguments args, make_flags = extract_argument_group(args, '--make-flags') # For each available build_type plugin, let it run the preprocessor for build_type in yield_supported_build_types(): build_type_impl = build_type.load()() args, tmp_extras = build_type_impl.argument_preprocessor(args) extras.update(tmp_extras) args = combine_make_flags(make_flags, args, extras) return args, extras
def argument_preprocessor(self, args): # The ament CMake pass-through flag collects dashed options. # This requires special handling or argparse will complain about # unrecognized options. args, gradle_args = extract_argument_group(args, '--ament-gradle-args') extras = {'ament_gradle_args': gradle_args, } return args, extras
def argument_preprocessor(args): """Run verb and plugin preprocessors on arguments. The preprocessors take in raw arguments and return potentially trimmed arguments and extra options to be added to the argparse NameSpace object. This can fail if the positional path argument does not contain a valid path or if the build type of the package at that path does not have a corresponding build type plugin. :param list args: list of arguments as str's :returns: tuple of left over arguments and dictionary of extra options :raises: SystemError if underlying assumptions are not met """ extras = {} # Extract make arguments args, make_flags = extract_argument_group(args, '--make-flags') # Detected build type if possible parser = argparse.ArgumentParser() add_path_argument(parser) opts, _ = parser.parse_known_args(args) try: path = validate_package_manifest_path(opts.path) except (MissingPluginError, ValueError) as exc: sys.exit("{0}".format(exc)) build_type = get_build_type(path) build_type_impl = get_class_for_build_type(build_type)() # Let detected build type plugin do argument preprocessing args, extras = build_type_impl.argument_preprocessor(args) args = combine_make_flags(make_flags, args, extras) return args, extras
def argument_preprocessor(self, args): args, bazel_args = extract_argument_group(args, '--bazel-args') extras = { 'bazel_args': bazel_args, } return args, extras