示例#1
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
示例#2
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
示例#3
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
示例#4
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
示例#5
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
示例#6
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
示例#7
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
示例#8
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