Beispiel #1
0
def prepare_arguments(parser):

    add_context_args(parser)

    add = parser.add_argument

    information_group = parser.add_argument_group('Information', 'Control which information is shown.')
    group = information_group.add_mutually_exclusive_group()
    group.add_argument('--deps', '--dependencies', default=False, action='store_true',
                       help="Show direct dependencies of each package.")
    group.add_argument('--rdeps', '--recursive-dependencies', default=False, action='store_true',
                       help="Show recursive dependencies of each package.")

    packages_group = parser.add_argument_group('Packages', 'Control which packages are listed.')
    add = packages_group.add_argument
    add('--depends-on', nargs='*', metavar='PKG', default=[],
        help="Only show packages that directly depend on specific package(s).")
    add('--rdepends-on', '--recursive-depends-on', nargs='*', metavar='PKG', default=[],
        help="Only show packages that recursively depend on specific package(s).")
    add('--this', action='store_true',
        help="Show the package which contains the current working directory.")

    behavior_group = parser.add_argument_group('Interface', 'The behavior of the command-line interface.')
    add = behavior_group.add_argument
    add('--quiet', default=False, action='store_true',
        help="Don't print out detected package warnings.")
    add('--unformatted', '-u', default=None, action='store_true',
        help='Print list without punctuation and additional details.')

    return parser
Beispiel #2
0
def prepare_arguments(parser):

    add_context_args(parser)

    add = parser.add_argument
    # What packages to build
    add('folders',
        nargs='*',
        help=
        'Folders in which to find packages. (default: workspace source space)')
    add('--deps',
        '--dependencies',
        default=False,
        action='store_true',
        help="List dependencies of each package.")
    add('--depends-on',
        nargs='*',
        help="List all packages that depend on supplied argument package(s).")
    add('--quiet',
        default=False,
        action='store_true',
        help="Don't print out detected package warnings.")
    add('--unformatted',
        '-u',
        default=None,
        action='store_true',
        help='Print list without punctuation and additional details.')

    return parser
Beispiel #3
0
def prepare_arguments(parser):
    add_context_args(parser)  # Adds the --profile option, possibly other things.

    # Behavior
    behavior_group = parser.add_argument_group('Behavior')
    add = behavior_group.add_argument
    add('-e', '--existing-only', action='store_true',
        help="Only print paths to existing directories.")
    add('-r', '--relative', action='store_true',
        help="Print relative paths instead of the absolute paths.")
    add('-q', '--quiet', action='store_true',
        help="Suppress warning output.")

    # Path options
    dir_group = parser.add_argument_group(
        'Sub-Space Options',
        'Get the absolute path to one of the following locations in the given '
        'workspace with the given profile.')
    dir_group_mut = dir_group.add_mutually_exclusive_group()
    add = dir_group_mut.add_argument
    add('-s', '--src', dest='space', action='store_const', const='src',
        help="Get the path to the source space.")
    add('-b', '--build', dest='space', action='store_const', const='build',
        help="Get the path to the build space.")
    add('-d', '--devel', dest='space', action='store_const', const='devel',
        help="Get the path to the devel space.")
    add('-i', '--install', dest='space', action='store_const', const='install',
        help="Get the path to the install space.")

    pkg_group = parser.add_argument_group(
        'Package Directories',
        "Get the absolute path to package directories in the given workspace "
        "and sub-space. By default this will output paths in the workspace's "
        "source space. If the -b (--build) flag is given, it will output the "
        "path to the package's build directory. If the -d or -i (--devel or "
        "--install) flags are given, it will output the path to the package's "
        "share directory in that space. If no package is provided, the base "
        "space paths are printed, e.g. `catkin locate -s` might return "
        "`/path/to/ws/src` and `catkin locate -s foo` might return "
        "`/path/to/ws/src/foo`.")
    pkg_group_mut = pkg_group.add_mutually_exclusive_group()
    add = pkg_group_mut.add_argument
    add('package', metavar='PACKAGE', nargs='?',
        help="The name of a package to locate.")
    add('--this', action="store_true",
        help="Locate package containing current working directory.")

    special_group = parser.add_argument_group(
        'Special Directories',
        'Get the absolute path to a special catkin location')
    add = special_group.add_argument
    add('--shell-verbs', action='store_true',
        help="Get the path to the shell verbs script.")
    add('--examples', action='store_true',
        help="Get the path to the examples directory.")

    return parser
Beispiel #4
0
def prepare_arguments(parser):
    # Workspace / profile args
    add_context_args(parser)

    # Basic group
    basic_group = parser.add_argument_group("Basic", "Clean workspace subdirectories.")
    add = basic_group.add_argument
    add(
        "-a",
        "--all",
        action="store_true",
        default=False,
        help="Remove all of the *spaces associated with the given or active"
        " profile. This will remove everything but the source space and the"
        " hidden .catkin_tools directory.",
    )
    add("-b", "--build", action="store_true", default=False, help="Remove the buildspace.")
    add("-d", "--devel", action="store_true", default=False, help="Remove the develspace.")
    add("-i", "--install", action="store_true", default=False, help="Remove the installspace.")

    # Advanced group
    advanced_group = parser.add_argument_group(
        "Advanced",
        "Clean only specific parts of the workspace. These options will "
        "automatically enable the --force-cmake option for the next build "
        "invocation.",
    )
    add = advanced_group.add_argument
    add(
        "-c",
        "--cmake-cache",
        action="store_true",
        default=False,
        help="Clear the CMakeCache for each package, but leave build and devel spaces.",
    )

    add(
        "-s",
        "--setup-files",
        action="store_true",
        default=False,
        help="Clear the catkin-generated files in order to rebase onto another workspace.",
    )

    add(
        "-o",
        "--orphans",
        action="store_true",
        default=False,
        help="Remove only build directories whose source packages are no"
        " longer enabled or in the source space. This might require"
        " --force-cmake on the next build.",
    )

    return parser
Beispiel #5
0
def prepare_arguments(parser):
    add_context_args(parser)  # Adds the --profile option, possibly other things.

    # Behavior
    behavior_group = parser.add_argument_group('Behavior')
    add = behavior_group.add_argument
    add('-e', '--existing-only', action='store_true',
        help="Only print paths to existing directories.")
    add('-r', '--relative', action='store_true',
        help="Print relative paths instead of the absolute paths.")
    add('-q', '--quiet', action='store_true',
        help="Suppress warning output.")

    # Path options
    dir_group = parser.add_argument_group(
        'Sub-Space Options',
        'Get the absolute path to one of the following locations in the given '
        'workspace with the given profile.')
    dir_group_mut = dir_group.add_mutually_exclusive_group()
    add = dir_group_mut.add_argument
    add('-s', '--src', dest='space', action='store_const', const='src',
        help="Get the path to the source space.")
    add('-b', '--build', dest='space', action='store_const', const='build',
        help="Get the path to the build space.")
    add('-d', '--devel', dest='space', action='store_const', const='devel',
        help="Get the path to the devel space.")
    add('-i', '--install', dest='space', action='store_const', const='install',
        help="Get the path to the install space.")

    pkg_group = parser.add_argument_group(
        'Package Directories',
        "Get the absolute path to package directories in the given workspace "
        "and sub-space. By default this will output paths in the workspace's "
        "source space. If the -b (--build) flag is given, it will output the "
        "path to the package's build directory. If the -d or -i (--devel or "
        "--install) flags are given, it will output the path to the package's "
        "share directory in that space. If no package is provided, the base "
        "space paths are printed, e.g. `catkin locate -s` might return "
        "`/path/to/ws/src` and `catkin locate -s foo` might return "
        "`/path/to/ws/src/foo`.")
    add = pkg_group.add_argument
    add('package', metavar='PACKAGE', nargs='?',
        help="The name of a package to locate.")

    special_group = parser.add_argument_group(
        'Special Directories',
        'Get the absolute path to a special catkin location')
    add = special_group.add_argument
    add('--shell-verbs', action='store_true',
        help="Get the path to the shell verbs script.")
    add('--examples', action='store_true',
        help="Get the path to the examples directory.")

    return parser
Beispiel #6
0
def prepare_arguments(parser):
    add_context_args(parser)
    clang_binary = parser.add_argument
    clang_binary('-c', '--clang-tidy', nargs="?", default="clang-tidy-9", help="Name of clang-tidy binary, e.g. 'clang-tidy-9'")
    fix = parser.add_argument
    fix('-f', '--fix', action='store_true', default=False, help="Apply fixes")
    export = parser.add_argument
    export('-e', '--export', nargs=1, help="Export fixes to file (unsets -f)")
    pkg = parser.add_argument
    pkg('package', help="Package to run for")
    src = parser.add_argument
    src('src_file', nargs='*', help="Source files to run for")
    return parser
Beispiel #7
0
def prepare_arguments(parser):

    add_context_args(parser)

    add = parser.add_argument
    # What packages to build
    add('folders', nargs='*',
        help='Folders in which to find packages. (default: workspace source space)')
    add('--deps', '--dependencies', default=False, action='store_true',
        help="List dependencies of each package.")
    add('--depends-on', nargs='*',
        help="List all packages that depend on supplied argument package(s).")
    add('--quiet', default=False, action='store_true',
        help="Don't print out detected package warnings.")
    add('--unformatted', '-u', default=None, action='store_true',
        help='Print list without punctuation and additional details.')

    return parser
Beispiel #8
0
def prepare_arguments(parser):
    # Workspace / profile args
    add_context_args(parser)

    # Basic group
    basic_group = parser.add_argument_group('Basic', 'Clean workspace subdirectories.')
    add = basic_group.add_argument
    add('-a', '--all', action='store_true', default=False,
        help='Remove all of the *spaces associated with the given or active'
        ' profile. This will remove everything but the source space and the'
        ' hidden .catkin_tools directory.')
    add('-b', '--build', action='store_true', default=False,
        help='Remove the buildspace.')
    add('-d', '--devel', action='store_true', default=False,
        help='Remove the develspace.')
    add('-i', '--install', action='store_true', default=False,
        help='Remove the installspace.')

    # Advanced group
    advanced_group = parser.add_argument_group(
        'Advanced',
        "Clean only specific parts of the workspace. These options will "
        "automatically enable the --force-cmake option for the next build "
        "invocation.")
    add = advanced_group.add_argument
    add('-c', '--cmake-cache', action='store_true', default=False,
        help='Clear the CMakeCache for each package, but leave build and devel spaces.')

    add('-s', '--setup-files', action='store_true', default=False,
        help='Clear the catkin-generated files in order to rebase onto another workspace.')

    add('-o', '--orphans', action='store_true', default=False,
        help='Remove only build directories whose source packages are no'
        ' longer enabled or in the source space. This might require'
        ' --force-cmake on the next build.')

    return parser
Beispiel #9
0
def prepare_arguments(parser):
    # Workspace / profile args
    add_context_args(parser)

    # Basic group
    basic_group = parser.add_argument_group('Basic', 'Clean workspace subdirectories.')
    add = basic_group.add_argument
    add('-a', '--all', action='store_true', default=False,
        help='Remove all of the *spaces associated with the given or active'
        ' profile. This will remove everything but the source space and the'
        ' hidden .catkin_tools directory.')
    add('-b', '--build', action='store_true', default=False,
        help='Remove the buildspace.')
    add('-d', '--devel', action='store_true', default=False,
        help='Remove the develspace.')
    add('-i', '--install', action='store_true', default=False,
        help='Remove the installspace.')

    # Advanced group
    advanced_group = parser.add_argument_group(
        'Advanced',
        "Clean only specific parts of the workspace. These options will "
        "automatically enable the --force-cmake option for the next build "
        "invocation.")
    add = advanced_group.add_argument
    add('-c', '--cmake-cache', action='store_true', default=False,
        help='Clear the CMakeCache for each package, but leave build and devel spaces.')

    add('-s', '--setup-files', action='store_true', default=False,
        help='Clear the catkin-generated files in order to rebase onto another workspace.')

    add('-o', '--orphans', action='store_true', default=False,
        help='Remove only build directories whose source packages are no'
        ' longer enabled or in the source space. This might require'
        ' --force-cmake on the next build.')

    return parser
Beispiel #10
0
def prepare_arguments(parser):
    # Workspace / profile args
    add_context_args(parser)

    subparsers = parser.add_subparsers(dest='subcommand', help='sub-command help')

    parser_pkg = subparsers.add_parser('pkg', help='Create a new catkin package.')

    parser_pkg.description = (
        "Create a new Catkin package. Note that while the "
        "default options used by this command are sufficient for prototyping and "
        "local usage, it is important that any publicly-available packages have "
        "a valid license and a valid maintainer e-mail address.")

    add = parser_pkg.add_argument

    add('name', metavar='PKG_NAME', nargs='+',
        help='The name of one or more packages to create. This name should be '
        'completely lower-case with individual words separated by underscores.')

    add('-p', '--path', action='store', default=os.getcwd(),
        help='The path into which the package should be generated.')

    # TODO: Make this possible
    # add('--manifest-only', action='store_true', default=False,
    #     help='Only create a package.xml manifest file and do not generate a CMakeLists.txt')

    # TODO: Make this possible
    # add('--build-type', type=str, choices=['catkin', 'cmake'],
    #     nargs=1,
    #     default='catkin',
    #     help='The buildtool to use to build the package. (default: catkin)')

    rosdistro_name = os.environ.get('ROS_DISTRO', None)
    add('--rosdistro', required=rosdistro_name is None, default=rosdistro_name,
        help='The ROS distro (default: environment variable ROS_DISTRO if defined)')

    basic_group = parser_pkg.add_argument_group('Package Metadata')
    add = basic_group.add_argument

    add('-v', '--version',
        metavar='MAJOR.MINOR.PATCH',
        action='store',
        help='Initial package version. (default 0.0.0)')
    add('-l', '--license',
        action='append',
        help='The software license under which the code is distributed, such as '
        'BSD, MIT, GPLv3, or others. (default: "TODO")')
    add('-m', '--maintainer',
        metavar=('NAME', 'EMAIL'),
        dest='maintainers',
        action='append',
        nargs=2,
        help='A maintainer who is responsible for the package. (default: '
        '[username, [email protected]]) (multiple allowed)')
    add('-a', '--author',
        metavar=('NAME', 'EMAIL'),
        dest='authors',
        action='append',
        nargs=2,
        help='An author who contributed to the package. (default: no additional '
        'authors) (multiple allowed)')
    add('-d', '--description',
        action='store',
        help='Description of the package. (default: empty)')

    deps_group = parser_pkg.add_argument_group('Package Dependencies')
    add = deps_group.add_argument
    add('--catkin-deps', '-c', metavar='DEP', nargs="*",
        help='The names of one or more Catkin dependencies. These are '
        'Catkin-based packages which are either built as source or installed '
        'by your system\'s package manager.')
    add('--system-deps', '-s', metavar='DEP', nargs="*",
        help='The names of one or more system dependencies. These are other '
        'packages installed by your operating system\'s package manager.')

    cpp_group = parser_pkg.add_argument_group('C++ Options')
    add = cpp_group.add_argument
    add('--boost-components',
        metavar='COMP',
        nargs='*',
        help='One or more boost components used by the package.')

    # py_group = parser_pkg.add_argument_group('Python Options')
    # add('--python-setup', action='store_true', default=False,
    #     help='Add a default python setup file.')

    return parser
Beispiel #11
0
def prepare_arguments(parser):

    parser.description = "This verb is used to configure a catkin workspace's\
    configuration and layout. Calling `catkin config` with no arguments will\
    display the current config and affect no changes if a config already exists\
    for the current workspace and profile."

    # Workspace / profile args
    add_context_args(parser)

    behavior_group = parser.add_argument_group(
        'Behavior', 'Options affecting argument handling.')
    add = behavior_group.add_mutually_exclusive_group().add_argument
    add('--append-args',
        '-a',
        action='store_true',
        default=False,
        help='For list-type arguments, append elements.')
    add('--remove-args',
        '-r',
        action='store_true',
        default=False,
        help='For list-type arguments, remove elements.')

    context_group = parser.add_argument_group(
        'Workspace Context', 'Options affecting the context of the workspace.')
    add = context_group.add_argument
    add('--init',
        action='store_true',
        default=False,
        help='Initialize a workspace if it does not yet exist.')
    add = context_group.add_mutually_exclusive_group().add_argument
    add('--extend',
        '-e',
        dest='extend_path',
        type=str,
        help='Explicitly extend the result-space of another catkin workspace, '
        'overriding the value of $CMAKE_PREFIX_PATH.')
    add('--no-extend',
        dest='extend_path',
        action='store_const',
        const='',
        help=
        'Un-set the explicit extension of another workspace as set by --extend.'
        )
    add = context_group.add_argument
    add('--mkdirs',
        action='store_true',
        default=False,
        help=
        'Create directories required by the configuration (e.g. source space) if they do not already exist.'
        )

    lists_group = parser.add_argument_group(
        'Package Build Defaults',
        'Packages to include or exclude from default build behavior.')
    add = lists_group.add_mutually_exclusive_group().add_argument
    add('--whitelist',
        metavar="PKG",
        dest='whitelist',
        nargs="+",
        required=False,
        type=str,
        default=None,
        help='Set the packages on the whitelist. If the whitelist is non-empty, '
        'only the packages on the whitelist are built with a bare call to '
        '`catkin build`.')
    add('--no-whitelist',
        dest='whitelist',
        action='store_const',
        const=[],
        default=None,
        help='Clear all packages from the whitelist.')
    add = lists_group.add_mutually_exclusive_group().add_argument
    add('--blacklist',
        metavar="PKG",
        dest='blacklist',
        nargs="+",
        required=False,
        type=str,
        default=None,
        help='Set the packages on the blacklist. Packages on the blacklist are '
        'not built with a bare call to `catkin build`.')
    add('--no-blacklist',
        dest='blacklist',
        action='store_const',
        const=[],
        default=None,
        help='Clear all packages from the blacklist.')

    spaces_group = parser.add_argument_group(
        'Spaces', 'Location of parts of the catkin workspace.')
    add = spaces_group.add_mutually_exclusive_group().add_argument
    add('-s',
        '--source-space',
        default=None,
        help='The path to the source space.')
    add('--default-source-space',
        action='store_const',
        dest='source_space',
        default=None,
        const=Context.DEFAULT_SOURCE_SPACE,
        help='Use the default path to the source space ("src")')
    add = spaces_group.add_mutually_exclusive_group().add_argument
    add('-b',
        '--build-space',
        default=None,
        help='The path to the build space.')
    add('--default-build-space',
        action='store_const',
        dest='build_space',
        default=None,
        const=Context.DEFAULT_BUILD_SPACE,
        help='Use the default path to the build space ("build")')
    add = spaces_group.add_mutually_exclusive_group().add_argument
    add('-d',
        '--devel-space',
        default=None,
        help='Sets the target devel space')
    add('--default-devel-space',
        action='store_const',
        dest='devel_space',
        default=None,
        const=Context.DEFAULT_DEVEL_SPACE,
        help='Sets the default target devel space ("devel")')
    add = spaces_group.add_mutually_exclusive_group().add_argument
    add('-i',
        '--install-space',
        default=None,
        help='Sets the target install space')
    add('--default-install-space',
        action='store_const',
        dest='install_space',
        default=None,
        const=Context.DEFAULT_INSTALL_SPACE,
        help='Sets the default target install space ("install")')
    add = spaces_group.add_argument
    add('-x',
        '--space-suffix',
        help=
        'Suffix for build, devel, and install space if they are not otherwise explicitly set.'
        )

    devel_group = parser.add_argument_group(
        'Devel Space',
        'Options for configuring the structure of the devel space.')
    add = devel_group.add_mutually_exclusive_group().add_argument
    add('--isolate-devel',
        action='store_true',
        default=None,
        help=
        'Build products from each catkin package into isolated devel spaces.')
    add('--merge-devel',
        dest='isolate_devel',
        action='store_false',
        default=None,
        help=
        'Build products from each catkin package into a single merged devel spaces.'
        )

    install_group = parser.add_argument_group(
        'Install Space',
        'Options for configuring the structure of the install space.')
    add = install_group.add_mutually_exclusive_group().add_argument
    add('--install',
        action='store_true',
        default=None,
        help='Causes each package to be installed to the install space.')
    add('--no-install',
        dest='install',
        action='store_false',
        default=None,
        help='Disables installing each package into the install space.')

    add = install_group.add_mutually_exclusive_group().add_argument
    add('--isolate-install',
        action='store_true',
        default=None,
        help='Install each catkin package into a separate install space.')
    add('--merge-install',
        dest='isolate_install',
        action='store_false',
        default=None,
        help='Install each catkin package into a single merged install space.')

    build_group = parser.add_argument_group(
        'Build Options', 'Options for configuring the way packages are built.')
    add_cmake_and_make_and_catkin_make_args(build_group)

    return parser
def prepare_arguments(parser):
    add_context_args(parser)

    # What packages to document
    pkg_group = parser.add_argument_group(
        'Packages', 'Control which packages get documented.')
    add = pkg_group.add_argument
    add('packages',
        metavar='PKGNAME',
        nargs='*',
        help=
        'Workspace packages to document, package dependencies are documented as well unless --no-deps is used. '
        'If no packages are given, then all the packages are documented.')
    add('--this',
        dest='document_this',
        action='store_true',
        default=False,
        help='Build the package containing the current working directory.')
    add('--no-deps',
        action='store_true',
        default=False,
        help='Only document specified packages, not their dependencies.')

    add('-j',
        '--jobs',
        default=None,
        help=
        'Maximum number of build jobs to be distributed across active packages. (default is cpu count)'
        )
    add('-p',
        '--parallel-packages',
        metavar='PACKAGE_JOBS',
        dest='parallel_jobs',
        default=None,
        help=
        'Maximum number of packages allowed to be built in parallel (default is cpu count)'
        )

    start_with_group = pkg_group.add_mutually_exclusive_group()
    add = start_with_group.add_argument
    add('--start-with',
        metavar='PKGNAME',
        type=str,
        help=
        'Build a given package and those which depend on it, skipping any before it.'
        )
    add('--start-with-this',
        action='store_true',
        default=False,
        help=
        'Similar to --start-with, starting with the package containing the current directory.'
        )

    add = pkg_group.add_argument
    add('--continue-on-failure',
        '-c',
        action='store_true',
        default=False,
        help=
        'Try to continue documenting packages whose dependencies documented successfully even if some other requested '
        'packages fail to document.')

    behavior_group = parser.add_argument_group(
        'Interface', 'The behavior of the command-line interface.')
    add = behavior_group.add_argument
    add('--verbose',
        '-v',
        action='store_true',
        default=False,
        help=
        'Print output from commands in ordered blocks once the command finishes.'
        )
    add('--interleave-output',
        '-i',
        action='store_true',
        default=False,
        help=
        'Prevents ordering of command output when multiple commands are running at the same time.'
        )
    add('--no-status',
        action='store_true',
        default=False,
        help=
        'Suppresses status line, useful in situations where carriage return is not properly supported.'
        )
    add('--summarize',
        '--summary',
        '-s',
        action='store_true',
        default=None,
        help=
        'Adds a document summary to the end of a document; defaults to on with --continue-on-failure, off otherwise'
        )
    add('--no-summarize',
        '--no-summary',
        action='store_false',
        dest='summarize',
        help='Explicitly disable the end of document summary')

    def status_rate_type(rate):
        rate = float(rate)
        if rate < 0:
            raise argparse.ArgumentTypeError(
                "must be greater than or equal to zero.")
        return rate

    add('--limit-status-rate',
        '--status-rate',
        type=status_rate_type,
        default=10.0,
        help=
        'Limit the update rate of the status bar to this frequency. Zero means unlimited. '
        'Must be positive, default is 10 Hz.')
    add('--no-notify',
        action='store_true',
        default=False,
        help='Suppresses system pop-up notification.')

    return parser
Beispiel #13
0
def prepare_arguments(parser):

    parser.description = "This verb is used to configure a catkin workspace's\
    configuration and layout. Calling `catkin config` with no arguments will\
    display the current config and affect no changes if a config already exists\
    for the current workspace and profile."

    # Workspace / profile args
    add_context_args(parser)

    context_group = parser.add_argument_group('Workspace Context', 'Options affecting the context of the workspace.')
    add = context_group.add_argument
    add('--init', action='store_true', default=False,
        help='Initialize a workspace if it does not yet exist.')
    add = context_group.add_mutually_exclusive_group().add_argument
    add('--extend', '-e', dest='extend_path', type=str,
        help='Explicitly extend the result-space of another catkin workspace, '
        'overriding the value of $CMAKE_PREFIX_PATH.')
    add('--no-extend', dest='extend_path', action='store_const', const='',
        help='Un-set the explicit extension of another workspace as set by --extend.')
    add = context_group.add_argument
    add('--mkdirs', action='store_true', default=False,
        help='Create directories required by the configuration (e.g. source space) if they do not already exist.')

    spaces_group = parser.add_argument_group('Spaces', 'Location of parts of the catkin workspace.')
    add = spaces_group.add_mutually_exclusive_group().add_argument
    add('-s', '--source-space', default=None,
        help='The path to the source space.')
    add('--default-source-space',
        action='store_const', dest='source_space', default=None, const=Context.DEFAULT_SOURCE_SPACE,
        help='Use the default path to the source space ("src")')
    add = spaces_group.add_mutually_exclusive_group().add_argument
    add('-b', '--build-space', default=None,
        help='The path to the build space.')
    add('--default-build-space',
        action='store_const', dest='build_space', default=None, const=Context.DEFAULT_BUILD_SPACE,
        help='Use the default path to the build space ("build")')
    add = spaces_group.add_mutually_exclusive_group().add_argument
    add('-d', '--devel-space', default=None,
        help='Sets the target devel space')
    add('--default-devel-space',
        action='store_const', dest='devel_space', default=None, const=Context.DEFAULT_DEVEL_SPACE,
        help='Sets the default target devel space ("devel")')
    add = spaces_group.add_mutually_exclusive_group().add_argument
    add('-i', '--install-space', default=None,
        help='Sets the target install space')
    add('--default-install-space',
        action='store_const', dest='install_space', default=None, const=Context.DEFAULT_INSTALL_SPACE,
        help='Sets the default target install space ("install")')
    add = spaces_group.add_argument
    add('-x', '--space-suffix',
        help='Suffix for build, devel, and install space if they are not otherwise explicitly set.')

    devel_group = parser.add_argument_group(
        'Devel Space', 'Options for configuring the structure of the devel space.')
    add = devel_group.add_mutually_exclusive_group().add_argument
    add('--isolate-devel', action='store_true', default=None,
        help='Build products from each catkin package into isolated devel spaces.')
    add('--merge-devel', dest='isolate_devel', action='store_false', default=None,
        help='Build products from each catkin package into a single merged devel spaces.')

    install_group = parser.add_argument_group(
        'Install Space', 'Options for configuring the structure of the install space.')
    add = install_group.add_mutually_exclusive_group().add_argument
    add('--install', action='store_true', default=None,
        help='Causes each package to be installed to the install space.')
    add('--no-install', dest='install', action='store_false', default=None,
        help='Disables installing each package into the install space.')

    add = install_group.add_mutually_exclusive_group().add_argument
    add('--isolate-install', action='store_true', default=None,
        help='Install each catkin package into a separate install space.')
    add('--merge-install', dest='isolate_install', action='store_false', default=None,
        help='Install each catkin package into a single merged install space.')

    build_group = parser.add_argument_group('Build Options', 'Options for configuring the way packages are built.')
    add_cmake_and_make_and_catkin_make_args(build_group)

    return parser
Beispiel #14
0
def prepare_arguments(parser):

    parser.description = "Build one or more packages in a catkin workspace.\
    This invokes `CMake`, `make`, and optionally `make install` for either all\
    or the specified packages in a catkin workspace.\
    \
    Arguments passed to this verb can temporarily override persistent options\
    stored in the catkin profile config. If you want to save these options, use\
    the --save-config argument. To see the current config, use the\
    `catkin config` command."

    # Workspace / profile args
    add_context_args(parser)
    # Sub-commands
    add = parser.add_argument
    add('--dry-run', '-n', action='store_true', default=False,
        help='List the packages which will be built with the given arguments without building them.')
    # What packages to build
    pkg_group = parser.add_argument_group('Packages', 'Control which packages get built.')
    add = pkg_group.add_argument
    add('packages', metavar='PKGNAME', nargs='*',
        help='Workspace packages to build, package dependencies are built as well unless --no-deps is used. '
             'If no packages are given, then all the packages are built.')
    add('--this', dest='build_this', action='store_true', default=False,
        help='Build the package containing the current working directory.')
    add('--no-deps', action='store_true', default=False,
        help='Only build specified packages, not their dependencies.')
    start_with_group = pkg_group.add_mutually_exclusive_group()
    add = start_with_group.add_argument
    add('--start-with', metavar='PKGNAME', type=str,
        help='Build a given package and those which depend on it, skipping any before it.')
    add('--start-with-this', action='store_true', default=False,
        help='Similar to --start-with, starting with the package containing the current directory.')

    # Build options
    build_group = parser.add_argument_group('Build', 'Control the build behaiovr.')
    add = build_group.add_argument
    add('--force-cmake', action='store_true', default=None,
        help='Runs cmake explicitly for each catkin package.')
    add('--no-install-lock', action='store_true', default=None,
        help='Prevents serialization of the install steps, which is on by default to prevent file install collisions')

    config_group = parser.add_argument_group('Config', 'Parameters for the underlying buildsystem.')
    add = config_group.add_argument
    add('--save-config', action='store_true', default=False,
        help='Save any configuration options in this section for the next build invocation.')
    add_cmake_and_make_and_catkin_make_args(config_group)

    # Behavior
    behavior_group = parser.add_argument_group('Interface', 'The behavior of the command-line interface.')
    add = behavior_group.add_argument
    add('--force-color', action='store_true', default=False,
        help='Forces catkin build to ouput in color, even when the terminal does not appear to support it.')
    add('--verbose', '-v', action='store_true', default=False,
        help='Print output from commands in ordered blocks once the command finishes.')
    add('--interleave-output', '-i', action='store_true', default=False,
        help='Prevents ordering of command output when multiple commands are running at the same time.')
    add('--no-status', action='store_true', default=False,
        help='Suppresses status line, useful in situations where carriage return is not properly supported.')
    add('--no-notify', action='store_true', default=False,
        help='Suppresses system popup notification.')

    return parser
Beispiel #15
0
def prepare_arguments(parser):
    parser.description = """\
Test one or more packages in a catkin workspace.
This invokes `make run_tests` or `make test` for either all or the specified
packages in a catkin workspace.\
"""

    # Workspace / profile args
    add_context_args(parser)
    # Sub-commands
    # What packages to test
    pkg_group = parser.add_argument_group(
        'Packages', 'Control which packages get tested.')
    add = pkg_group.add_argument
    add('packages',
        metavar='PKGNAME',
        nargs='*',
        help=
        'Workspace packages to test. If no packages are given, then all the packages are tested.'
        )
    add('--this',
        dest='build_this',
        action='store_true',
        default=False,
        help='Test the package containing the current working directory.')
    add('--continue-on-failure',
        '-c',
        action='store_true',
        default=False,
        help=
        'Continue testing packages even if the tests for other requested packages fail.'
        )

    config_group = parser.add_argument_group(
        'Config', 'Parameters for the underlying build system.')
    add = config_group.add_argument
    add('-p',
        '--parallel-packages',
        metavar='PACKAGE_JOBS',
        dest='parallel_jobs',
        default=None,
        type=int,
        help=
        'Maximum number of packages allowed to be built in parallel (default is cpu count)'
        )
    add('-t',
        '--test-target',
        metavar='TARGET',
        default=None,
        type=str,
        help=
        'Make target to run for tests (default is "run_tests" for catkin and "test" for cmake)'
        )
    add('--catkin-test-target',
        metavar='TARGET',
        default=None,
        type=str,
        help=
        'Make target to run for tests for catkin packages, overwrites --test-target (default is "run_tests")'
        )
    add('--make-args',
        metavar='ARG',
        dest='make_args',
        nargs='+',
        required=False,
        type=str,
        default=None,
        help='Arbitrary arguments which are passed to make. '
        'It collects all of following arguments until a "--" is read.')

    interface_group = parser.add_argument_group(
        'Interface', 'The behavior of the command-line interface.')
    add = interface_group.add_argument
    add('--verbose',
        '-v',
        action='store_true',
        default=False,
        help=
        'Print output from commands in ordered blocks once the command finishes.'
        )
    add('--interleave-output',
        '-i',
        action='store_true',
        default=False,
        help=
        'Prevents ordering of command output when multiple commands are running at the same time.'
        )
    add('--summarize',
        '--summary',
        '-s',
        action='store_true',
        default=None,
        help='Adds a summary to the end of the log')
    add('--no-status',
        action='store_true',
        default=False,
        help=
        'Suppresses status line, useful in situations where carriage return is not properly supported.'
        )

    def status_rate_type(rate):
        rate = float(rate)
        if rate < 0:
            raise argparse.ArgumentTypeError(
                "must be greater than or equal to zero.")
        return rate

    add('--limit-status-rate',
        '--status-rate',
        type=status_rate_type,
        default=10.0,
        help=
        'Limit the update rate of the status bar to this frequency. Zero means unlimited. '
        'Must be positive, default is 10 Hz.')
    add('--no-notify',
        action='store_true',
        default=False,
        help='Suppresses system pop-up notification.')

    # Deprecated arguments
    # colors are handled by the main catkin command
    add('--no-color', action='store_true', help=argparse.SUPPRESS)
    add('--force-color', action='store_true', help=argparse.SUPPRESS)
    # no-deps became the default
    add('--no-deps', action='store_true', help=argparse.SUPPRESS)

    return parser
Beispiel #16
0
def prepare_arguments(parser):

    parser.description = "This verb is used to configure a catkin workspace's\
    configuration and layout. Calling `catkin config` with no arguments will\
    display the current config and affect no changes if a config already exists\
    for the current workspace and profile."

    # Workspace / profile args
    add_context_args(parser)

    behavior_group = parser.add_argument_group('Behavior', 'Options affecting argument handling.')
    add = behavior_group.add_mutually_exclusive_group().add_argument
    add('--append-args', '-a', action='store_true', default=False,
        help='For list-type arguments, append elements.')
    add('--remove-args', '-r', action='store_true', default=False,
        help='For list-type arguments, remove elements.')

    context_group = parser.add_argument_group('Workspace Context', 'Options affecting the context of the workspace.')
    add = context_group.add_argument
    add('--init', action='store_true', default=False,
        help='Initialize a workspace if it does not yet exist.')
    add = context_group.add_mutually_exclusive_group().add_argument
    add('--extend', '-e', dest='extend_path', type=str,
        help='Explicitly extend the result-space of another catkin workspace, '
        'overriding the value of $CMAKE_PREFIX_PATH.')
    add('--no-extend', dest='extend_path', action='store_const', const='',
        help='Un-set the explicit extension of another workspace as set by --extend.')
    add = context_group.add_argument
    add('--mkdirs', action='store_true', default=False,
        help='Create directories required by the configuration (e.g. source space) if they do not already exist.')

    lists_group = parser.add_argument_group(
        'Package Build Defaults', 'Packages to include or exclude from default build behavior.')
    add = lists_group.add_mutually_exclusive_group().add_argument
    add('--whitelist', metavar="PKG", dest='whitelist', nargs="+", required=False, type=str, default=None,
        help='Set the packages on the whitelist. If the whitelist is non-empty, '
        'only the packages on the whitelist are built with a bare call to '
        '`catkin build`.')
    add('--no-whitelist', dest='whitelist', action='store_const', const=[], default=None,
        help='Clear all packages from the whitelist.')
    add = lists_group.add_mutually_exclusive_group().add_argument
    add('--blacklist', metavar="PKG", dest='blacklist', nargs="+", required=False, type=str, default=None,
        help='Set the packages on the blacklist. Packages on the blacklist are '
        'not built with a bare call to `catkin build`.')
    add('--no-blacklist', dest='blacklist', action='store_const', const=[], default=None,
        help='Clear all packages from the blacklist.')

    spaces_group = parser.add_argument_group('Spaces', 'Location of parts of the catkin workspace.')
    Context.setup_space_keys()
    for space, space_dict in Context.SPACES.items():
        add = spaces_group.add_mutually_exclusive_group().add_argument
        flags = ['--{}-space'.format(space)]
        flags.extend([space_dict['short_flag']] if 'short_flag' in space_dict else [])
        add(*flags, default=None,
            help='The path to the {} space.'.format(space))
        add('--default-{}-space'.format(space),
            action='store_const', dest='{}_space'.format(space), default=None, const=space_dict['default'],
            help='Use the default path to the {} space ("{}")'.format(space, space_dict['default']))
    add = spaces_group.add_argument
    add('-x', '--space-suffix',
        help='Suffix for build, devel, and install space if they are not otherwise explicitly set.')

    devel_group = parser.add_argument_group(
        'Devel Space', 'Options for configuring the structure of the devel space.')
    add = devel_group.add_mutually_exclusive_group().add_argument
    add('--link-devel', dest='devel_layout', action='store_const', const='linked', default=None,
        help='Build products from each catkin package into isolated spaces,'
        ' then symbolically link them into a merged devel space.')
    add('--merge-devel', dest='devel_layout', action='store_const', const='merged', default=None,
        help='Build products from each catkin package into a single merged devel spaces.')
    add('--isolate-devel', dest='devel_layout', action='store_const', const='isolated', default=None,
        help='Build products from each catkin package into isolated devel spaces.')

    install_group = parser.add_argument_group(
        'Install Space', 'Options for configuring the structure of the install space.')
    add = install_group.add_mutually_exclusive_group().add_argument
    add('--install', action='store_true', default=None,
        help='Causes each package to be installed to the install space.')
    add('--no-install', dest='install', action='store_false', default=None,
        help='Disables installing each package into the install space.')

    add = install_group.add_mutually_exclusive_group().add_argument
    add('--isolate-install', action='store_true', default=None,
        help='Install each catkin package into a separate install space.')
    add('--merge-install', dest='isolate_install', action='store_false', default=None,
        help='Install each catkin package into a single merged install space.')

    build_group = parser.add_argument_group('Build Options', 'Options for configuring the way packages are built.')
    add_cmake_and_make_and_catkin_make_args(build_group)

    return parser
Beispiel #17
0
def prepare_arguments(parser):
    parser.description = """\
Build one or more packages in a catkin workspace.
This invokes `CMake`, `make`, and optionally `make install` for either all
or the specified packages in a catkin workspace.

Arguments passed to this verb can temporarily override persistent options
stored in the catkin profile config. If you want to save these options, use
the --save-config argument. To see the current config, use the
`catkin config` command.\
"""

    # Workspace / profile args
    add_context_args(parser)
    # Sub-commands
    add = parser.add_argument
    add('--dry-run', '-n', action='store_true', default=False,
        help='List the packages which will be built with the given arguments without building them.')
    add('--get-env', dest='get_env', metavar='PKGNAME', nargs=1,
        help='Print the environment in which PKGNAME is built to stdout.')

    # What packages to build
    pkg_group = parser.add_argument_group('Packages', 'Control which packages get built.')
    add = pkg_group.add_argument
    add('packages', metavar='PKGNAME', nargs='*',
        help='Workspace packages to build, package dependencies are built as well unless --no-deps is used. '
             'If no packages are given, then all the packages are built.')
    add('--this', dest='build_this', action='store_true', default=False,
        help='Build the package containing the current working directory.')
    add('--no-deps', action='store_true', default=False,
        help='Only build specified packages, not their dependencies.')
    add('--unbuilt', action='store_true', default=False,
        help='Build packages which have yet to be built.')

    start_with_group = pkg_group.add_mutually_exclusive_group()
    add = start_with_group.add_argument
    add('--start-with', metavar='PKGNAME', type=str,
        help='Build a given package and those which depend on it, skipping any before it.')
    add('--start-with-this', action='store_true', default=False,
        help='Similar to --start-with, starting with the package containing the current directory.')
    add = pkg_group.add_argument
    add('--continue-on-failure', '-c', action='store_true', default=False,
        help='Try to continue building packages whose dependencies built successfully even if some other requested '
             'packages fail to build.')

    # Build options
    build_group = parser.add_argument_group('Build', 'Control the build behavior.')
    add = build_group.add_argument
    add('--force-cmake', action='store_true', default=None,
        help='Runs cmake explicitly for each catkin package.')
    add('--pre-clean', action='store_true', default=None,
        help='Runs `make clean` before building each package.')
    add('--no-install-lock', action='store_true', default=None,
        help='Prevents serialization of the install steps, which is on by default to prevent file install collisions')

    config_group = parser.add_argument_group('Config', 'Parameters for the underlying build system.')
    add = config_group.add_argument
    add('--save-config', action='store_true', default=False,
        help='Save any configuration options in this section for the next build invocation.')
    add_cmake_and_make_and_catkin_make_args(config_group)

    # Behavior
    behavior_group = parser.add_argument_group('Interface', 'The behavior of the command-line interface.')
    add = behavior_group.add_argument
    add('--verbose', '-v', action='store_true', default=False,
        help='Print output from commands in ordered blocks once the command finishes.')
    add('--interleave-output', '-i', action='store_true', default=False,
        help='Prevents ordering of command output when multiple commands are running at the same time.')
    add('--no-status', action='store_true', default=False,
        help='Suppresses status line, useful in situations where carriage return is not properly supported.')
    add('--summarize', '--summary', '-s', action='store_true', default=None,
        help='Adds a build summary to the end of a build; defaults to on with --continue-on-failure, off otherwise')
    add('--no-summarize', '--no-summary', action='store_false', dest='summarize',
        help='Explicitly disable the end of build summary')
    add('--override-build-tool-check', action='store_true', default=False,
        help='use to override failure due to using differnt build tools on the same workspace.')

    # Deprecated args now handled by main catkin command
    add('--no-color', action='store_true', help=argparse.SUPPRESS)
    add('--force-color', action='store_true', help=argparse.SUPPRESS)

    # Experimental args
    add('--mem-limit', default=None, help=argparse.SUPPRESS)

    # Advanced args
    add('--develdebug', metavar='LEVEL', default=None, help=argparse.SUPPRESS)

    def status_rate_type(rate):
        rate = float(rate)
        if rate < 0:
            raise argparse.ArgumentTypeError("must be greater than or equal to zero.")
        return rate

    add('--limit-status-rate', '--status-rate', type=status_rate_type, default=10.0,
        help='Limit the update rate of the status bar to this frequency. Zero means unlimited. '
             'Must be positive, default is 10 Hz.')
    add('--no-notify', action='store_true', default=False,
        help='Suppresses system pop-up notification.')

    return parser
Beispiel #18
0
def prepare_arguments(parser):

    parser.description = "This verb is used to configure a catkin workspace's\
    configuration and layout. Calling `catkin config` with no arguments will\
    display the current config and affect no changes if a config already exists\
    for the current workspace and profile."

    # Workspace / profile args
    add_context_args(parser)

    behavior_group = parser.add_argument_group(
        'Behavior', 'Options affecting argument handling.')
    add = behavior_group.add_mutually_exclusive_group().add_argument
    add('--append-args',
        '-a',
        action='store_true',
        default=False,
        help='For list-type arguments, append elements.')
    add('--remove-args',
        '-r',
        action='store_true',
        default=False,
        help='For list-type arguments, remove elements.')

    context_group = parser.add_argument_group(
        'Workspace Context', 'Options affecting the context of the workspace.')
    add = context_group.add_argument
    add('--init',
        action='store_true',
        default=False,
        help='Initialize a workspace if it does not yet exist.')
    add = context_group.add_mutually_exclusive_group().add_argument
    add('--extend',
        '-e',
        dest='extend_path',
        type=str,
        help='Explicitly extend the result-space of another catkin workspace, '
        'overriding the value of $CMAKE_PREFIX_PATH.')
    add('--no-extend',
        dest='extend_path',
        action='store_const',
        const='',
        help=
        'Un-set the explicit extension of another workspace as set by --extend.'
        )
    add = context_group.add_argument
    add('--mkdirs',
        action='store_true',
        default=False,
        help=
        'Create directories required by the configuration (e.g. source space) if they do not already exist.'
        )

    create_group = parser.add_argument_group(
        'Package Create Defaults',
        'Information of default authors/maintainers of created packages')
    add = create_group.add_mutually_exclusive_group().add_argument
    add('--authors',
        metavar=('NAME', 'EMAIL'),
        dest='authors',
        nargs='+',
        required=False,
        type=str,
        default=None,
        help='Set the default authors of created packages')
    add('--maintainers',
        metavar=('NAME', 'EMAIL'),
        dest='maintainers',
        nargs='+',
        required=False,
        type=str,
        default=None,
        help='Set the default maintainers of created packages')
    add('--licenses',
        metavar=('LICENSE'),
        dest='licenses',
        nargs='+',
        required=False,
        type=str,
        default=None,
        help='Set the default licenses of created packages')

    lists_group = parser.add_argument_group(
        'Package Build Defaults',
        'Packages to include or exclude from default build behavior.')
    add = lists_group.add_mutually_exclusive_group().add_argument
    add('--whitelist',
        metavar="PKG",
        dest='whitelist',
        nargs="+",
        required=False,
        type=str,
        default=None,
        help='Set the packages on the whitelist. If the whitelist is non-empty, '
        'only the packages on the whitelist are built with a bare call to '
        '`catkin build`.')
    add('--no-whitelist',
        dest='whitelist',
        action='store_const',
        const=[],
        default=None,
        help='Clear all packages from the whitelist.')
    add = lists_group.add_mutually_exclusive_group().add_argument
    add('--blacklist',
        metavar="PKG",
        dest='blacklist',
        nargs="+",
        required=False,
        type=str,
        default=None,
        help='Set the packages on the blacklist. Packages on the blacklist are '
        'not built with a bare call to `catkin build`.')
    add('--no-blacklist',
        dest='blacklist',
        action='store_const',
        const=[],
        default=None,
        help='Clear all packages from the blacklist.')

    spaces_group = parser.add_argument_group(
        'Spaces', 'Location of parts of the catkin workspace.')
    Context.setup_space_keys()
    for space, space_dict in Context.SPACES.items():
        add = spaces_group.add_mutually_exclusive_group().add_argument
        flags = ['--{}-space'.format(space)]
        flags.extend([space_dict['short_flag']] if 'short_flag' in
                     space_dict else [])
        add(*flags,
            default=None,
            help='The path to the {} space.'.format(space))
        add('--default-{}-space'.format(space),
            action='store_const',
            dest='{}_space'.format(space),
            default=None,
            const=space_dict['default'],
            help='Use the default path to the {} space ("{}")'.format(
                space, space_dict['default']))
    add = spaces_group.add_argument
    add('-x',
        '--space-suffix',
        help=
        'Suffix for build, devel, and install space if they are not otherwise explicitly set.'
        )

    devel_group = parser.add_argument_group(
        'Devel Space',
        'Options for configuring the structure of the devel space.')
    add = devel_group.add_mutually_exclusive_group().add_argument
    add('--link-devel',
        dest='devel_layout',
        action='store_const',
        const='linked',
        default=None,
        help='Build products from each catkin package into isolated spaces,'
        ' then symbolically link them into a merged devel space.')
    add('--merge-devel',
        dest='devel_layout',
        action='store_const',
        const='merged',
        default=None,
        help=
        'Build products from each catkin package into a single merged devel spaces.'
        )
    add('--isolate-devel',
        dest='devel_layout',
        action='store_const',
        const='isolated',
        default=None,
        help=
        'Build products from each catkin package into isolated devel spaces.')

    install_group = parser.add_argument_group(
        'Install Space',
        'Options for configuring the structure of the install space.')
    add = install_group.add_mutually_exclusive_group().add_argument
    add('--install',
        action='store_true',
        default=None,
        help='Causes each package to be installed to the install space.')
    add('--no-install',
        dest='install',
        action='store_false',
        default=None,
        help='Disables installing each package into the install space.')

    add = install_group.add_mutually_exclusive_group().add_argument
    add('--isolate-install',
        action='store_true',
        default=None,
        help='Install each catkin package into a separate install space.')
    add('--merge-install',
        dest='isolate_install',
        action='store_false',
        default=None,
        help='Install each catkin package into a single merged install space.')

    build_group = parser.add_argument_group(
        'Build Options', 'Options for configuring the way packages are built.')
    add_cmake_and_make_and_catkin_make_args(build_group)

    return parser
Beispiel #19
0
def prepare_arguments(parser):
    # Workspace / profile args
    add_context_args(parser)

    add = parser.add_argument
    add('--dry-run', '-n', action='store_true', default=False,
        help='Show the effects of the clean action without modifying the workspace.')
    add('--verbose', '-v', action='store_true', default=False,
        help='Verbose status output.')
    add('--yes', '-y', action='store_true', default=False,
        help='Assume "yes" to all interactive checks.')
    add('--force', '-f', action='store_true', default=False,
        help='Allow cleaning files outside of the workspace root.')
    add('--all-profiles', action='store_true', default=False,
        help='Apply the specified clean operation for all profiles in this workspace.')

    full_group = parser.add_argument_group(
        'Full',
        'Remove everything except the source space.')
    add = full_group.add_argument
    add('--deinit', action='store_true', default=False,
        help='De-initialize the workspace, delete all build profiles and'
        ' configuration. This will also clean subdirectories for all profiles in'
        ' the workspace.')

    # Basic group
    basic_group = parser.add_argument_group(
        'Spaces',
        'Clean workspace subdirectories for the selected profile.')
    add = basic_group.add_argument
    add('-l', '--logs', action='store_true', default=False,
        help='Remove the entire log space.')
    add('-b', '--build', action='store_true', default=False,
        help='Remove the entire build space.')
    add('-d', '--devel', action='store_true', default=False,
        help='Remove the entire devel space.')
    add('-i', '--install', action='store_true', default=False,
        help='Remove the entire install space.')

    # Packages group
    packages_group = parser.add_argument_group(
        'Packages',
        "Clean products from specific packages in the workspace. Note that"
        " these options are only available in a `linked` devel space layout."
        " These options will also automatically enable the --force-cmake"
        " option for the next build invocation.")
    add = packages_group.add_argument
    add('packages', metavar='PKGNAME', nargs='*',
        help='Explicilty specify a list of specific packages to clean from the build, devel, and install space.')
    add('--dependents', '--deps', action='store_true', default=False,
        help='Clean the packages which depend on the packages to be cleaned.')
    add('--orphans', action='store_true', default=False,
        help='Remove products from packages are no longer in the source space. '
        'Note that this also removes packages which are '
        'blacklisted or which contain `CATKIN_INGORE` marker files.')

    # Advanced group
    advanced_group = parser.add_argument_group(
        'Advanced',
        "Clean other specific parts of the workspace.")
    add = advanced_group.add_argument
    add('--setup-files', action='store_true', default=False,
        help='Clear the catkin-generated setup files from the devel and install spaces.')

    return parser
Beispiel #20
0
def prepare_arguments(parser):
    # Workspace / profile args
    add_context_args(parser)

    add = parser.add_argument
    add('--dry-run', '-n', action='store_true', default=False,
        help='Show the effects of the clean action without modifying the workspace.')
    add('--verbose', '-v', action='store_true', default=False,
        help='Verbose status output.')
    add('--yes', '-y', action='store_true', default=False,
        help='Assume "yes" to all interactive checks.')
    add('--force', '-f', action='store_true', default=False,
        help='Allow cleaning files outside of the workspace root.')
    add('--all-profiles', action='store_true', default=False,
        help='Apply the specified clean operation for all profiles in this workspace.')

    full_group = parser.add_argument_group(
        'Full',
        'Remove everything except the source space.')
    add = full_group.add_argument
    add('--deinit', action='store_true', default=False,
        help='De-initialize the workspace, delete all build profiles and'
        ' configuration. This will also clean subdirectories for all profiles in'
        ' the workspace.')

    # Basic group
    spaces_group = parser.add_argument_group(
        'Spaces',
        'Clean workspace subdirectories for the selected profile.')
    Context.setup_space_keys()
    add = spaces_group.add_argument
    for space, space_dict in Context.SPACES.items():
        if space == 'source':
            continue
        flags = [space_dict['short_flag']] if 'short_flag' in space_dict else []
        flags.append('--{}'.format(space_dict['default']))
        flags.append('--{}-space'.format(space))
        add(*flags, dest='spaces', action='append_const', const=space,
            help='Remove the entire {} space.'.format(space))

    # Packages group
    packages_group = parser.add_argument_group(
        'Packages',
        "Clean products from specific packages in the workspace. Note that"
        " these options are only available in a `linked` devel space layout."
        " These options will also automatically enable the --force-cmake"
        " option for the next build invocation.")
    add = packages_group.add_argument
    add('packages', metavar='PKGNAME', nargs='*',
        help='Explicilty specify a list of specific packages to clean from the build, devel, and install space.')
    add('--this', dest='clean_this', action='store_true', default=False,
        help='Clean the package containing the current working directory from the build, devel, and install space.')
    add('--dependents', '--deps', action='store_true', default=False,
        help='Clean the packages which depend on the packages to be cleaned.')
    add('--orphans', action='store_true', default=False,
        help='Remove products from packages are no longer in the source space. '
        'Note that this also removes packages which are '
        'skiplisted or which contain `CATKIN_IGNORE` marker files.')

    # Advanced group
    advanced_group = parser.add_argument_group(
        'Advanced',
        "Clean other specific parts of the workspace.")
    add = advanced_group.add_argument
    add('--setup-files', action='store_true', default=False,
        help='Clear the catkin-generated setup files from the devel and install spaces.')

    return parser
Beispiel #21
0
def prepare_arguments_deps(parser):
    """Parse arguments that belong to this verb.

    Args:
        parser (argparser): Argument parser

    Returns:
        argparser: Parser that knows about our flags.
    """
    parser.description = """ Manage dependencies for one or more packages in
        a catkin workspace. This reads dependencies from package.xml file of
        each of the packages in the workspace and tries to download their
        sources from version control system of choice."""
    add_context_args(parser)

    parent_parser = ArgumentParser(add_help=False)

    # add config flags to all groups that need it
    parent_parser.add_argument(
        '--default_url',
        default="{package}",
        help='[deprecated] Where to look for packages by default.')
    parent_parser.add_argument(
        '--default_urls',
        default="{package}",
        help='A comma separated list of urls where to look for packages at.')

    # Behavior
    parent_parser.add_argument('--verbose',
                               '-v',
                               action='store_true',
                               default=False,
                               help='Print output from commands.')
    parent_parser.add_argument('--no_status',
                               action='store_true',
                               default=False,
                               help='Do not use progress status when cloning.')
    parent_parser.add_argument('--num_threads',
                               '-j',
                               type=int,
                               default=4,
                               help='Number of threads run in parallel.')

    packages_help_msg = """
        Packages for which the dependencies are analyzed.
        If no packages are given, all packages are processed."""

    # we need subparsers for this verb
    subparsers = parser.add_subparsers(dest='subverb', help="Possible verbs.")

    # add a parser for update sub-verb
    update_help_msg = """
        Update the existing repositories to their latest state from remote."""
    parser_update = subparsers.add_parser('update',
                                          help=update_help_msg,
                                          parents=[parent_parser])

    update_pkg_group = parser_update.add_argument_group(
        'Packages', 'Control for which packages we update dependencies.')
    update_pkg_group.add_argument('packages',
                                  metavar='PKGNAME',
                                  nargs='*',
                                  help=packages_help_msg)

    # add a parser for fetch sub-verb
    fetch_help_msg = """
        Fetch the dependencies stored package.xml files."""
    parser_fetch = subparsers.add_parser('fetch',
                                         help=fetch_help_msg,
                                         parents=[parent_parser])
    parser_fetch.add_argument('--update',
                              action='store_true',
                              default=True,
                              help="Update after fetch.")
    fetch_group = parser_fetch.add_argument_group(
        'Packages', 'Control for which packages we fetch dependencies.')
    fetch_group.add_argument('packages',
                             metavar='PKGNAME',
                             nargs='*',
                             help=packages_help_msg)

    return parser
Beispiel #22
0
def prepare_arguments(parser):

    parser.description = "Build one or more packages in a catkin workspace.\
    This invokes `CMake`, `make`, and optionally `make install` for either all\
    or the specified packages in a catkin workspace.\
    \
    Arguments passed to this verb can temporarily override persistent options\
    stored in the catkin profile config. If you want to save these options, use\
    the --save-config argument. To see the current config, use the\
    `catkin config` command."

    # Workspace / profile args
    add_context_args(parser)
    # Sub-commands
    add = parser.add_argument
    add('--dry-run',
        '-n',
        action='store_true',
        default=False,
        help=
        'List the packages which will be built with the given arguments without building them.'
        )
    # What packages to build
    pkg_group = parser.add_argument_group('Packages',
                                          'Control which packages get built.')
    add = pkg_group.add_argument
    add('packages',
        metavar='PKGNAME',
        nargs='*',
        help=
        'Workspace packages to build, package dependencies are built as well unless --no-deps is used. '
        'If no packages are given, then all the packages are built.')
    add('--this',
        dest='build_this',
        action='store_true',
        default=False,
        help='Build the package containing the current working directory.')
    add('--no-deps',
        action='store_true',
        default=False,
        help='Only build specified packages, not their dependencies.')
    start_with_group = pkg_group.add_mutually_exclusive_group()
    add = start_with_group.add_argument
    add('--start-with',
        metavar='PKGNAME',
        type=str,
        help=
        'Build a given package and those which depend on it, skipping any before it.'
        )
    add('--start-with-this',
        action='store_true',
        default=False,
        help=
        'Similar to --start-with, starting with the package containing the current directory.'
        )

    # Build options
    build_group = parser.add_argument_group('Build',
                                            'Control the build behaiovr.')
    add = build_group.add_argument
    add('--force-cmake',
        action='store_true',
        default=None,
        help='Runs cmake explicitly for each catkin package.')
    add('--no-install-lock',
        action='store_true',
        default=None,
        help=
        'Prevents serialization of the install steps, which is on by default to prevent file install collisions'
        )

    config_group = parser.add_argument_group(
        'Config', 'Parameters for the underlying buildsystem.')
    add = config_group.add_argument
    add('--save-config',
        action='store_true',
        default=False,
        help=
        'Save any configuration options in this section for the next build invocation.'
        )
    add_cmake_and_make_and_catkin_make_args(config_group)

    # Behavior
    behavior_group = parser.add_argument_group(
        'Interface', 'The behavior of the command-line interface.')
    add = behavior_group.add_argument
    add('--force-color',
        action='store_true',
        default=False,
        help=
        'Forces catkin build to ouput in color, even when the terminal does not appear to support it.'
        )
    add('--verbose',
        '-v',
        action='store_true',
        default=False,
        help=
        'Print output from commands in ordered blocks once the command finishes.'
        )
    add('--interleave-output',
        '-i',
        action='store_true',
        default=False,
        help=
        'Prevents ordering of command output when multiple commands are running at the same time.'
        )
    add('--no-status',
        action='store_true',
        default=False,
        help=
        'Suppresses status line, useful in situations where carriage return is not properly supported.'
        )

    def status_rate_type(rate):
        rate = float(rate)
        if rate < 0:
            raise argparse.ArgumentTypeError(
                "must be greater than or equal to zero.")
        return rate

    add('--limit-status-rate',
        '--status-rate',
        type=status_rate_type,
        default=0.0,
        help=
        'Limit the update rate of the status bar to this frequency. Zero means unlimited. '
        'Must be positive, default is 0.')
    add('--no-notify',
        action='store_true',
        default=False,
        help='Suppresses system popup notification.')

    return parser
Beispiel #23
0
def prepare_arguments(parser):
    parser.description = """\
Build one or more packages in a catkin workspace.
This invokes `CMake`, `make`, and optionally `make install` for either all
or the specified packages in a catkin workspace.

Arguments passed to this verb can temporarily override persistent options
stored in the catkin profile config. If you want to save these options, use
the --save-config argument. To see the current config, use the
`catkin config` command.\
"""

    # Workspace / profile args
    add_context_args(parser)
    # Sub-commands
    add = parser.add_argument
    add('--dry-run',
        '-n',
        action='store_true',
        default=False,
        help=
        'List the packages which will be built with the given arguments without building them.'
        )
    add('--get-env',
        dest='get_env',
        metavar='PKGNAME',
        nargs=1,
        help='Print the environment in which PKGNAME is built to stdout.')

    # What packages to build
    pkg_group = parser.add_argument_group('Packages',
                                          'Control which packages get built.')
    add = pkg_group.add_argument
    add('packages',
        metavar='PKGNAME',
        nargs='*',
        help=
        'Workspace packages to build, package dependencies are built as well unless --no-deps is used. '
        'If no packages are given, then all the packages are built.')
    add('--this',
        dest='build_this',
        action='store_true',
        default=False,
        help='Build the package containing the current working directory.')
    add('--no-deps',
        action='store_true',
        default=False,
        help='Only build specified packages, not their dependencies.')
    add('--unbuilt',
        action='store_true',
        default=False,
        help='Build packages which have yet to be built.')

    start_with_group = pkg_group.add_mutually_exclusive_group()
    add = start_with_group.add_argument
    add('--start-with',
        metavar='PKGNAME',
        type=str,
        help=
        'Build a given package and those which depend on it, skipping any before it.'
        )
    add('--start-with-this',
        action='store_true',
        default=False,
        help=
        'Similar to --start-with, starting with the package containing the current directory.'
        )
    add = pkg_group.add_argument
    add('--continue-on-failure',
        '-c',
        action='store_true',
        default=False,
        help=
        'Try to continue building packages whose dependencies built successfully even if some other requested '
        'packages fail to build.')

    # Build options
    build_group = parser.add_argument_group('Build',
                                            'Control the build behavior.')
    add = build_group.add_argument
    add('--force-cmake',
        action='store_true',
        default=None,
        help='Runs cmake explicitly for each catkin package.')
    add('--pre-clean',
        action='store_true',
        default=None,
        help='Runs `make clean` before building each package.')
    add('--no-install-lock',
        action='store_true',
        default=None,
        help=
        'Prevents serialization of the install steps, which is on by default to prevent file install collisions'
        )

    config_group = parser.add_argument_group(
        'Config', 'Parameters for the underlying build system.')
    add = config_group.add_argument
    add('--save-config',
        action='store_true',
        default=False,
        help=
        'Save any configuration options in this section for the next build invocation.'
        )
    add_cmake_and_make_and_catkin_make_args(config_group)

    # Behavior
    behavior_group = parser.add_argument_group(
        'Interface', 'The behavior of the command-line interface.')
    add = behavior_group.add_argument
    add('--verbose',
        '-v',
        action='store_true',
        default=False,
        help=
        'Print output from commands in ordered blocks once the command finishes.'
        )
    add('--interleave-output',
        '-i',
        action='store_true',
        default=False,
        help=
        'Prevents ordering of command output when multiple commands are running at the same time.'
        )
    add('--no-status',
        action='store_true',
        default=False,
        help=
        'Suppresses status line, useful in situations where carriage return is not properly supported.'
        )
    add('--summarize',
        '--summary',
        '-s',
        action='store_true',
        default=None,
        help=
        'Adds a build summary to the end of a build; defaults to on with --continue-on-failure, off otherwise'
        )
    add('--no-summarize',
        '--no-summary',
        action='store_false',
        dest='summarize',
        help='Explicitly disable the end of build summary')
    add('--override-build-tool-check',
        action='store_true',
        default=False,
        help=
        'use to override failure due to using differnt build tools on the same workspace.'
        )

    # Deprecated args now handled by main catkin command
    add('--no-color', action='store_true', help=argparse.SUPPRESS)
    add('--force-color', action='store_true', help=argparse.SUPPRESS)

    # Experimental args
    add('--mem-limit', default=None, help=argparse.SUPPRESS)

    # Advanced args
    add('--develdebug', metavar='LEVEL', default=None, help=argparse.SUPPRESS)

    def status_rate_type(rate):
        rate = float(rate)
        if rate < 0:
            raise argparse.ArgumentTypeError(
                "must be greater than or equal to zero.")
        return rate

    add('--limit-status-rate',
        '--status-rate',
        type=status_rate_type,
        default=10.0,
        help=
        'Limit the update rate of the status bar to this frequency. Zero means unlimited. '
        'Must be positive, default is 10 Hz.')
    add('--no-notify',
        action='store_true',
        default=False,
        help='Suppresses system pop-up notification.')

    return parser
Beispiel #24
0
def prepare_arguments(parser):
    add_context_args(parser)

    # What packages to test
    pkg_group = parser.add_argument_group(
        'Packages', 'Control which packages have tests built and run.')
    add = pkg_group.add_argument
    add('packages',
        metavar='PKGNAME',
        nargs='*',
        help=
        'Workspace packages to test. If no packages are given, then all the packages are tested.'
        )
    add('--this',
        dest='test_this',
        action='store_true',
        default=False,
        help='Build the package containing the current working directory.')
    add('-j',
        '--jobs',
        default=None,
        help=
        'Maximum number of build jobs to be distributed across active packages. (default is cpu count)'
        )
    add('-p',
        '--parallel-packages',
        metavar='PACKAGE_JOBS',
        dest='parallel_jobs',
        default=None,
        help=
        'Maximum number of packages allowed to be built in parallel (default is cpu count)'
        )

    behavior_group = parser.add_mutually_exclusive_group(
    )  #'Testing', 'Selection of specific tests to run.')
    add = behavior_group.add_argument
    add('--list',
        dest='list_tests',
        action='store_true',
        default=False,
        help=
        'Do not build or run, only list available tests in selected packages.')
    add('--tests',
        '-t',
        nargs='+',
        type=str,
        default=None,
        help='Specify exact tests to run.')
    add('--get-env',
        metavar='PKGNAME',
        type=str,
        default=None,
        help='Get environment to run tests for specific package.')

    behavior_group = parser.add_argument_group(
        'Interface', 'The behavior of the command-line interface.')
    add = behavior_group.add_argument
    add('--verbose',
        '-v',
        action='store_true',
        default=False,
        help=
        'Print output from commands in ordered blocks once the command finishes.'
        )
    add('--interleave-output',
        '-i',
        action='store_true',
        default=False,
        help=
        'Prevents ordering of command output when multiple commands are running at the same time.'
        )
    add('--no-status',
        action='store_true',
        default=False,
        help=
        'Suppresses status line, useful in situations where carriage return is not properly supported.'
        )

    def status_rate_type(rate):
        rate = float(rate)
        if rate < 0:
            raise argparse.ArgumentTypeError(
                "must be greater than or equal to zero.")
        return rate

    add('--limit-status-rate',
        '--status-rate',
        type=status_rate_type,
        default=10.0,
        help=
        'Limit the update rate of the status bar to this frequency. Zero means unlimited. '
        'Must be positive, default is 10 Hz.')
    add('--no-notify',
        action='store_true',
        default=False,
        help='Suppresses system pop-up notification.')

    return parser