def get_args(sysargv=None):
    parser = argparse.ArgumentParser(description='Builds the ROS2 repositories as a single batch job')
    parser.add_argument('--packaging', default=False, action='store_true', help='create an archive of the install space')
    parser.add_argument('--repo-file-url', required=True, help='url of the ros2.repos file to fetch and use for the basis of the batch job')
    parser.add_argument('--supplemental-repo-file-url', default=None, help='url of a .repos file to fetch and merge with the ros2.repos file')
    parser.add_argument('--test-branch', default=None, help='branch to attempt to checkout before doing batch job')
    parser.add_argument('--colcon-branch', default=None, help="Use a specific branch of the colcon repositories, if the branch doesn't exist fall back to the default branch (default: latest release)")
    parser.add_argument('--white-space-in', nargs='*', default=[], choices=['sourcespace', 'buildspace', 'installspace', 'workspace'], help='which folder structures in which white space should be added')
    parser.add_argument('--do-venv', default=False, action='store_true', help='create and use a virtual env in the build process')
    parser.add_argument('--os', default=None, choices=['linux', 'osx', 'windows'])
    parser.add_argument('--ignore-rmw', nargs='*', default=[], help='ignore the passed RMW implementations as well as supporting packages')
    parser.add_argument('--connext-debs', default=False, action='store_true', help='use Debian packages for Connext instead of binaries off the RTI website (Linux only)')
    parser.add_argument('--isolated', default=False, action='store_true', help='build and install each package a separate folders')
    parser.add_argument('--force-ansi-color', default=False, action='store_true', help='forces this program to output ansi color')
    parser.add_argument('--ros-distro', required=True, help='The ROS distribution being built')
    parser.add_argument('--ros1-path', default=None, help='path of ROS 1 workspace to be sourced')
    parser.add_argument('--mixed-ros-overlay-pkgs', nargs='*', default=[], help='space separated list of packages to be built in an overlay workspace with ROS 1')
    parser.add_argument('--colcon-mixin-url', default=None, help='A mixin index url to be included by colcon')
    parser.add_argument('--cmake-build-type', default=None, help='select the CMake build type')
    parser.add_argument('--build-args', default=None, help="arguments passed to the 'build' verb")
    parser.add_argument('--test-args', default=None, help="arguments passed to the 'test' verb")
    parser.add_argument('--src-mounted', default=False, action='store_true', help='src directory is already mounted into the workspace')
    parser.add_argument('--compile-with-clang', default=False, action='store_true', help='compile with clang instead of gcc')
    parser.add_argument('--coverage', default=False, action='store_true', help='enable collection of coverage statistics')
    parser.add_argument('--workspace-path', default=None, help='base path of the workspace')
    parser.add_argument('--python-interpreter', default=None, help='pass different Python interpreter')
    parser.add_argument('--visual-studio-version', default=None, required=(os.name == 'nt'), help='select the Visual Studio version')
    parser.add_argument('--source-space', dest='sourcespace', help='source directory path')
    parser.add_argument('--build-space', dest='buildspace', help='build directory path')
    parser.add_argument('--install-space', dest='installspace', help='install directory path')
    argv = (sysargv[1:] if (sysargv is not None) else sys.argv[1:])
    (argv, build_args) = extract_argument_group(argv, '--build-args')
    if ('--test-args' in argv):
        (argv, test_args) = extract_argument_group(argv, '--test-args')
    else:
        (build_args, test_args) = extract_argument_group(build_args, '--test-args')
    args = parser.parse_args(argv)
    args.build_args = build_args
    args.test_args = test_args
    for name in ('sourcespace', 'buildspace', 'installspace'):
        space_directory = getattr(args, name)
        if ((name in args.white_space_in) and (space_directory is not None)):
            raise Exception('Argument {} and "--white-space-in" cannot both be used'.format(name))
        elif (space_directory is None):
            space_directory = colcon_space_defaults[name]
            if (name in args.white_space_in):
                space_directory += ' space'
            setattr(args, name, space_directory)
    return args
def get_args(sysargv=None):
    parser = argparse.ArgumentParser(description='Builds the ROS2 repositories as a single batch job')
    parser.add_argument('--packaging', default=False, action='store_true', help='create an archive of the install space')
    parser.add_argument('--repo-file-url', required=True, help='url of the ros2.repos file to fetch and use for the basis of the batch job')
    parser.add_argument('--supplemental-repo-file-url', default=None, help='url of a .repos file to fetch and merge with the ros2.repos file')
    parser.add_argument('--test-branch', default=None, help='branch to attempt to checkout before doing batch job')
    parser.add_argument('--colcon-branch', default=None, help="Use a specific branch of the colcon repositories, if the branch doesn't exist fall back to the default branch (default: latest release)")
    parser.add_argument('--white-space-in', nargs='*', default=[], choices=['sourcespace', 'buildspace', 'installspace', 'workspace'], help='which folder structures in which white space should be added')
    parser.add_argument('--do-venv', default=False, action='store_true', help='create and use a virtual env in the build process')
    parser.add_argument('--os', default=None, choices=['linux', 'osx', 'windows'])
    parser.add_argument('--ignore-rmw', nargs='*', default=[], help='ignore the passed RMW implementations as well as supporting packages')
    parser.add_argument('--connext-debs', default=False, action='store_true', help='use Debian packages for Connext instead of binaries off the RTI website (Linux only)')
    parser.add_argument('--isolated', default=False, action='store_true', help='build and install each package a separate folders')
    parser.add_argument('--force-ansi-color', default=False, action='store_true', help='forces this program to output ansi color')
    parser.add_argument('--ros-distro', required=True, help='The ROS distribution being built')
    parser.add_argument('--ros1-path', default=None, help='path of ROS 1 workspace to be sourced')
    parser.add_argument('--mixed-ros-overlay-pkgs', nargs='*', default=[], help='space separated list of packages to be built in an overlay workspace with ROS 1')
    parser.add_argument('--colcon-mixin-url', default=None, help='A mixin index url to be included by colcon')
    parser.add_argument('--cmake-build-type', default=None, help='select the CMake build type')
    parser.add_argument('--build-args', default=None, help="arguments passed to the 'build' verb")
    parser.add_argument('--test-args', default=None, help="arguments passed to the 'test' verb")
    parser.add_argument('--src-mounted', default=False, action='store_true', help='src directory is already mounted into the workspace')
    parser.add_argument('--compile-with-clang', default=False, action='store_true', help='compile with clang instead of gcc')
    parser.add_argument('--coverage', default=False, action='store_true', help='enable collection of coverage statistics')
    parser.add_argument('--workspace-path', default=None, help='base path of the workspace')
    parser.add_argument('--python-interpreter', default=None, help='pass different Python interpreter')
    parser.add_argument('--visual-studio-version', default=None, required=(os.name == 'nt'), help='select the Visual Studio version')
    parser.add_argument('--source-space', dest='sourcespace', help='source directory path')
    parser.add_argument('--build-space', dest='buildspace', help='build directory path')
    parser.add_argument('--install-space', dest='installspace', help='install directory path')
    argv = (sysargv[1:] if (sysargv is not None) else sys.argv[1:])
    (argv, build_args) = extract_argument_group(argv, '--build-args')
    if ('--test-args' in argv):
        (argv, test_args) = extract_argument_group(argv, '--test-args')
    else:
        (build_args, test_args) = extract_argument_group(build_args, '--test-args')
    args = parser.parse_args(argv)
    args.build_args = build_args
    args.test_args = test_args
    for name in ('sourcespace', 'buildspace', 'installspace'):
        space_directory = getattr(args, name)
        if ((name in args.white_space_in) and (space_directory is not None)):
            raise Exception('Argument {} and "--white-space-in" cannot both be used'.format(name))
        elif (space_directory is None):
            space_directory = colcon_space_defaults[name]
            if (name in args.white_space_in):
                space_directory += ' space'
            setattr(args, name, space_directory)
    return args