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()
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)
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()
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'
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)
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()
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()
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( '--lcov-base', default='lcov', help='The path for lcov artifacts (default: lcov)' ) parser.add_argument( '--lcov-config-file', default=Path(__file__).parent / 'configuration' / 'lcovrc', help='The path to the lcov configuration (default: configuration/lcovrc)' ) parser.add_argument( '--verbose', action='store_true', help='Show coverage rates for individual packages' ) parser.add_argument( '--initial', action='store_true', help='Generate baseline (zero) coverage. This option is meant to be used before ' 'running `colcon test`' ) parser.add_argument( '--zero-counters', action='store_true', help='Zero the coverage counters' ) parser.add_argument( '--filter', nargs='*', help='Remove files matching FILTER from total coverage (e.g. "*/test/*")' ) add_packages_arguments(parser) add_log_level_argument(parser) add_executor_arguments(parser) add_event_handler_arguments(parser)
def add_arguments(self, *, parser): # noqa: D102 parser.add_argument( '--build-base', default='build', help= 'The base path for all build directories (default: %(default)s)', ) parser.add_argument( '--coveragepy-base', default='coveragepy', help= 'The path for coveragepy artifacts and outputs (default: %(default)s)', ) parser.add_argument( '--coverage-report-args', nargs='*', metavar='*', type=str.lstrip, help="Pass arguments to 'coverage report'. Arguments matching " 'other options must be prefixed by a space, ' 'e.g. --coverage-report-args " --help"', ) parser.add_argument( '--coverage-html-args', nargs='*', metavar='*', type=str.lstrip, help="Pass arguments to 'coverage html'. Arguments matching " 'other options must be prefixed by a space, ' 'e.g. --coverage-html-args " --help"', ) parser.add_argument( '--verbose', action='store_true', help='Show coverage results for individual packages and overall', ) add_packages_arguments(parser) add_log_level_argument(parser) add_executor_arguments(parser) add_event_handler_arguments(parser)
def test_add_executor_arguments(): parser = ArgumentParser() # extensions with the same priority with EntryPointContext(extension1=Extension1, extension2=Extension2, extension3=Extension3): with pytest.raises(AssertionError) as e: add_executor_arguments(parser) assert 'Executor extensions must have unique priorities' in \ str(e.value) # no extensions with EntryPointContext(): with pytest.raises(AssertionError) as e: add_executor_arguments(parser) assert 'No executor extensions found' in str(e.value) # choose executor by environment variable with EntryPointContext(extension1=Extension1, extension2=Extension2): extensions = get_executor_extensions() extensions[110]['extension2'].add_arguments = Mock( side_effect=RuntimeError('custom exception')) extensions[100]['extension1'].add_arguments = Mock(return_value=None) env = {DEFAULT_EXECUTOR_ENVIRONMENT_VARIABLE.name: 'extension1'} with EnvironmentContext(**env): with patch('colcon_core.executor.logger.error') as error: add_executor_arguments(parser) assert extensions[100]['extension1'].add_arguments.call_count == 1 # the raised exception is catched and results in an error message assert error.call_count == 1 assert len(error.call_args[0]) == 1 assert error.call_args[0][0].startswith( "Exception in executor extension 'extension2': custom exception\n") args = parser.parse_args([]) assert args.executor == 'extension1' # choose default executor parser = ArgumentParser() with EntryPointContext(extension1=Extension1, extension2=Extension2): add_executor_arguments(parser) args = parser.parse_args([]) assert args.executor == 'extension2'