Exemplo n.º 1
0
    def add_arguments(self, *, parser):  # noqa: D102
        parser.add_argument('--build-base', default='build',
                            help='The base path for all build directories ('
                                 'default: build)')
        parser.add_argument('--install-base', default='install',
                            help='The base path for all install prefixes ('
                                 'default: install)')
        parser.add_argument('--merge-install', action='store_true',
                            help='Merge all install prefixes into a single '
                                 'location')
        parser.add_argument('--bundle-base', default='bundle',
                            help='The base path for all bundle prefixes ('
                                 'default: bundle)')
        parser.add_argument(
            '--include-sources', action='store_true',
            help='Include a sources tarball for all packages installed into '
                 'the bundle via apt')
        parser.add_argument(
            '--bundle-version', default=2, type=int,
            help='Version of bundle to generate')
        parser.add_argument(
            '-U', '--upgrade', action='store_true',
            help='Upgrade all dependencies in the bundle to their latest '
                 'versions'
        )

        add_executor_arguments(parser)
        add_event_handler_arguments(parser)
        add_package_arguments(parser)

        decorated_parser = DestinationCollectorDecorator(parser)
        add_task_arguments(decorated_parser, 'colcon_bundle.task.bundle', )
        self.task_argument_destinations = decorated_parser.get_destinations()
        add_installer_arguments(decorated_parser)
Exemplo n.º 2
0
    def add_arguments(self, *, parser):  # noqa: D102
        parser.add_argument(
            '--build-base',
            default='build',
            help='The base path for all build directories (default: build)')
        parser.add_argument(
            '--install-base',
            default='install',
            help='The base path for all install prefixes (default: install)')
        parser.add_argument(
            '--merge-install',
            action='store_true',
            help='Merge all install prefixes into a single location')
        parser.add_argument(
            '--symlink-install',
            action='store_true',
            help='Use symlinks instead of copying files where possible')
        parser.add_argument(
            '--test-result-base',
            help='The base path for all test results (default: --build-base)')
        parser.add_argument(
            '--continue-on-error',
            action='store_true',
            help='Continue other packages when a package fails to build '
            '(packages recursively depending on the failed package are '
            'skipped)')
        add_executor_arguments(parser)
        add_event_handler_arguments(parser)

        add_packages_arguments(parser)

        decorated_parser = DestinationCollectorDecorator(parser)
        add_task_arguments(decorated_parser, 'colcon_core.task.build')
        self.task_argument_destinations = decorated_parser.get_destinations()
Exemplo n.º 3
0
def test_add_task_arguments():
    parser = Mock()
    task_name = 'build'
    with EntryPointContext(extension1=Extension1, extension2=Extension2):
        with patch('colcon_core.task.instantiate_extensions',
                   side_effect=instantiate_extensions_without_cache):
            extensions = get_task_extensions(task_name)
            # one exception, one success
            extensions['extension1'].add_arguments = Mock(
                side_effect=RuntimeError('custom exception'))
            with patch('colcon_core.task.logger.error') as error:
                add_task_arguments(parser, task_name)
            assert error.call_count == 1
            assert len(error.call_args[0]) == 1
            assert error.call_args[0][0].startswith(
                "Exception in task extension 'build.extension1': custom "
                'exception\n')

            # invalid return value
            extensions['extension1'].add_arguments = Mock()
            extensions['extension2'].add_arguments = Mock(return_value=None)
            with patch('colcon_core.task.logger.error') as error:
                add_task_arguments(parser, task_name)
            assert error.call_count == 1
            assert len(error.call_args[0]) == 1
            assert error.call_args[0][0].startswith(
                "Exception in task extension 'build.extension1': "
                'add_arguments() should return None\n')
            assert extensions['extension2'].add_arguments.call_count == 1
Exemplo n.º 4
0
    def add_arguments(self, *, parser):  # noqa: D102
        parser.add_argument(
            '--build-base',
            default='build',
            help='The base path for all build directories (default: build)')
        parser.add_argument(
            '--install-base',
            default='install',
            help='The base path for all install prefixes (default: install)')
        parser.add_argument(
            '--merge-install',
            action='store_true',
            help='Merge all install prefixes into a single location')
        parser.add_argument(
            '--symlink-install',
            action='store_true',
            help='Use symlinks instead of copying files where possible')
        parser.add_argument(
            '--test-result-base',
            help='The base path for all test results (default: --build-base)')
        add_executor_arguments(parser)
        add_event_handler_arguments(parser)

        add_packages_arguments(parser)

        decorated_parser = DestinationCollectorDecorator(parser)
        add_task_arguments(decorated_parser, 'build')
        self.task_argument_destinations = decorated_parser.get_destinations()
Exemplo n.º 5
0
    def add_arguments(self, *, parser):  # noqa: D102
        parser.add_argument(
            '--build-base',
            default='build',
            help='The base path for all build directories (default: build)')
        parser.add_argument(
            '--install-base',
            default='install',
            help='The base path for all install prefixes (default: install)')
        parser.add_argument(
            '--merge-install',
            action='store_true',
            help='Merge all install prefixes into a single location')
        parser.add_argument(
            '--test-result-base',
            help='The base path for all test results (default: --build-base)')
        group = parser.add_mutually_exclusive_group()
        group.add_argument(
            '--retest-until-fail',
            type=int, default=0, metavar='N',
            help='Rerun tests up to N times if they pass')
        group.add_argument(
            '--retest-until-pass',
            type=int, default=0, metavar='N',
            help='Rerun failing tests up to N times')
        parser.add_argument(
            '--abort-on-error',
            action='store_true',
            help='Abort after the first package with any errors (failing '
                 'tests are not considered errors in this context)')
        parser.add_argument(
            '--return-code-on-test-failure',
            action='store_true',
            help='Use a non-zero return code to indicate any test failure')
        add_executor_arguments(parser)
        add_event_handler_arguments(parser)

        add_packages_arguments(parser)

        decorated_parser = DestinationCollectorDecorator(parser)
        add_task_arguments(decorated_parser, 'colcon_core.task.test')
        self.task_argument_destinations = decorated_parser.get_destinations()
        self.task_argument_destinations['retest-until-pass'] = \
            'retest_until_pass'
        self.task_argument_destinations['retest-until-fail'] = \
            'retest_until_fail'
Exemplo n.º 6
0
    def add_arguments(self, *, parser):  # noqa: D102
        parser.add_argument('--build-base',
                            default='build',
                            help='The base path for all build directories ('
                            'default: build)')
        parser.add_argument('--install-base',
                            default='install',
                            help='The base path for all install prefixes ('
                            'default: install)')
        parser.add_argument('--merge-install',
                            action='store_true',
                            help='Merge all install prefixes into a single '
                            'location')
        parser.add_argument('--bundle-base',
                            default='bundle',
                            help='The base path for all bundle prefixes ('
                            'default: bundle)')
        parser.add_argument(
            '--include-sources',
            action='store_true',
            help='Include a sources tarball for all packages installed into '
            'the bundle via apt')
        parser.add_argument('--bundle-version',
                            default=1,
                            type=int,
                            help='Version of bundle to generate')

        parser.add_argument(
            '--use-cached-dependencies',
            action='store_true',
            help='Use this to skip download and installation of '
            'dependencies for quicker development cycles. This requires '
            'that you have already run "colcon bundle" successfully '
            'and all intermediate artifacts have been generated')

        add_executor_arguments(parser)
        add_event_handler_arguments(parser)
        add_package_arguments(parser)

        decorated_parser = DestinationCollectorDecorator(parser)
        add_task_arguments(
            decorated_parser,
            'colcon_bundle.task.bundle',
        )
        self.task_argument_destinations = decorated_parser.get_destinations()
        add_installer_arguments(decorated_parser)
Exemplo n.º 7
0
    def add_arguments(self, *, parser):  # noqa: D102
        parser.add_argument(
            '--build-base',
            default='build',
            help='The base path for all build directories (default: build)')

        parser.add_argument(
            '--ignore-dependencies',
            action='store_true',
            help='Ignore dependencies when capturing caches (default: false)')

        add_executor_arguments(parser)
        add_event_handler_arguments(parser)
        add_packages_arguments(parser)

        decorated_parser = DestinationCollectorDecorator(parser)
        add_task_arguments(decorated_parser, 'colcon_cache.task.lock')
        self.task_argument_destinations = decorated_parser.get_destinations()
Exemplo n.º 8
0
    def add_arguments(self, *, parser):  # noqa: D102
        if sys.version_info < (3, 8):
            # TODO(sloretz) remove when minimum supported Python version is 3.8
            parser.register('action', 'extend', _ExtendAction)
        parser.add_argument(
            '--build-base',
            default='build',
            help='The base path for all build directories (default: build)')
        parser.add_argument(
            '--install-base',
            default='install',
            help='The base path for all install prefixes (default: install)')
        parser.add_argument(
            '--merge-install',
            action='store_true',
            help='Merge all install prefixes into a single location')
        parser.add_argument(
            '--symlink-install',
            action='store_true',
            help='Use symlinks instead of copying files where possible')
        parser.add_argument(
            '--test-result-base',
            help='The base path for all test results (default: --build-base)')
        parser.add_argument(
            '--continue-on-error',
            action='store_true',
            help='Continue other packages when a package fails to build '
            '(packages recursively depending on the failed package are '
            'skipped)')
        parser.add_argument(
            '--allow-overriding',
            action='extend',
            default=[],
            metavar='PKG_NAME',
            nargs='+',
            help='Allow building packages that exist in underlay workspaces')
        add_executor_arguments(parser)
        add_event_handler_arguments(parser)

        add_packages_arguments(parser)

        decorated_parser = DestinationCollectorDecorator(parser)
        add_task_arguments(decorated_parser, 'colcon_core.task.build')
        self.task_argument_destinations = decorated_parser.get_destinations()