diff --git a/colcon_core/argument_parser/__init__.py b/colcon_core/argument_parser/__init__.py index 44f743133..21f069489 100644 --- a/colcon_core/argument_parser/__init__.py +++ b/colcon_core/argument_parser/__init__.py @@ -42,7 +42,7 @@ def decorate_argument_parser(self, *, parser): raise NotImplementedError() -def get_argument_parser_extensions(): +def get_argument_parser_extensions(*, group_name=None): """ Get the available argument parser extensions. @@ -50,7 +50,9 @@ def get_argument_parser_extensions(): :rtype: OrderedDict """ - extensions = instantiate_extensions(__name__) + if group_name is None: + group_name = __name__ + extensions = instantiate_extensions(group_name) for name, extension in extensions.items(): extension.ARGUMENT_PARSER_DECORATOR_NAME = name return order_extensions_by_priority(extensions) diff --git a/colcon_core/environment/__init__.py b/colcon_core/environment/__init__.py index d57adbf3b..a7324d017 100644 --- a/colcon_core/environment/__init__.py +++ b/colcon_core/environment/__init__.py @@ -47,7 +47,7 @@ def create_environment_hooks(self, prefix_path, pkg_name): raise NotImplementedError() -def get_environment_extensions(): +def get_environment_extensions(*, group_name=None): """ Get the available environment extensions. @@ -55,7 +55,9 @@ def get_environment_extensions(): :rtype: OrderedDict """ - extensions = instantiate_extensions(__name__) + if group_name is None: + group_name = __name__ + extensions = instantiate_extensions(group_name) for name in list(extensions.keys()): extension = extensions[name] extension.ENVIRONMENT_NAME = name diff --git a/colcon_core/event_handler/__init__.py b/colcon_core/event_handler/__init__.py index a51756c5b..437894626 100644 --- a/colcon_core/event_handler/__init__.py +++ b/colcon_core/event_handler/__init__.py @@ -44,7 +44,7 @@ def __call__(self, event): raise NotImplementedError() -def get_event_handler_extensions(*, context): +def get_event_handler_extensions(*, context, group_name=None): """ Get the available event handler extensions. @@ -52,7 +52,9 @@ def get_event_handler_extensions(*, context): :rtype: OrderedDict """ - extensions = instantiate_extensions(__name__) + if group_name is None: + group_name = __name__ + extensions = instantiate_extensions(group_name) for name, extension in extensions.items(): extension.EVENT_HANDLER_NAME = name extension.context = context diff --git a/colcon_core/executor/__init__.py b/colcon_core/executor/__init__.py index aca035758..c0bdaccf9 100644 --- a/colcon_core/executor/__init__.py +++ b/colcon_core/executor/__init__.py @@ -197,7 +197,7 @@ def _flush(self): self._event_controller.flush() -def get_executor_extensions(): +def get_executor_extensions(*, group_name=None): """ Get the available executor extensions. @@ -206,7 +206,9 @@ def get_executor_extensions(): :rtype: OrderedDict """ - extensions = instantiate_extensions(__name__) + if group_name is None: + group_name = __name__ + extensions = instantiate_extensions(group_name) for name, extension in extensions.items(): extension.EXECUTOR_NAME = name return order_extensions_grouped_by_priority(extensions) diff --git a/colcon_core/package_augmentation/__init__.py b/colcon_core/package_augmentation/__init__.py index 3b579292f..e741292a1 100644 --- a/colcon_core/package_augmentation/__init__.py +++ b/colcon_core/package_augmentation/__init__.py @@ -65,7 +65,7 @@ def augment_package( raise NotImplementedError() -def get_package_augmentation_extensions(): +def get_package_augmentation_extensions(*, group_name=None): """ Get the available package augmentation extensions. @@ -73,7 +73,9 @@ def get_package_augmentation_extensions(): :rtype: OrderedDict """ - extensions = instantiate_extensions(__name__) + if group_name is None: + group_name = __name__ + extensions = instantiate_extensions(group_name) for name, extension in extensions.items(): extension.PACKAGE_AUGMENTATION_NAME = name return order_extensions_by_priority(extensions) diff --git a/colcon_core/package_discovery/__init__.py b/colcon_core/package_discovery/__init__.py index fc60f1470..c16f3b1d3 100644 --- a/colcon_core/package_discovery/__init__.py +++ b/colcon_core/package_discovery/__init__.py @@ -84,7 +84,7 @@ def discover(self, *, args, identification_extensions): raise NotImplementedError() -def get_package_discovery_extensions(): +def get_package_discovery_extensions(*, group_name=None): """ Get the available package discovery extensions. @@ -92,7 +92,9 @@ def get_package_discovery_extensions(): :rtype: OrderedDict """ - extensions = instantiate_extensions(__name__) + if group_name is None: + group_name = __name__ + extensions = instantiate_extensions(group_name) for name, extension in extensions.items(): extension.PACKAGE_DISCOVERY_NAME = name return order_extensions_by_priority(extensions) diff --git a/colcon_core/package_identification/__init__.py b/colcon_core/package_identification/__init__.py index 11e17d73f..01dd8a2ce 100644 --- a/colcon_core/package_identification/__init__.py +++ b/colcon_core/package_identification/__init__.py @@ -64,7 +64,7 @@ def identify(self, desc: PackageDescriptor): raise NotImplementedError() -def get_package_identification_extensions(): +def get_package_identification_extensions(*, group_name=None): """ Get the available package identification extensions. @@ -73,7 +73,9 @@ def get_package_identification_extensions(): :rtype: OrderedDict """ - extensions = instantiate_extensions(__name__) + if group_name is None: + group_name = __name__ + extensions = instantiate_extensions(group_name) for name, extension in extensions.items(): extension.PACKAGE_IDENTIFICATION_NAME = name return order_extensions_grouped_by_priority(extensions) diff --git a/colcon_core/package_selection/__init__.py b/colcon_core/package_selection/__init__.py index 6b1bdc9f0..bdbacd887 100644 --- a/colcon_core/package_selection/__init__.py +++ b/colcon_core/package_selection/__init__.py @@ -85,7 +85,7 @@ def add_arguments(parser): _add_package_selection_arguments(parser) -def get_package_selection_extensions(): +def get_package_selection_extensions(*, group_name=None): """ Get the available package selection extensions. @@ -93,7 +93,9 @@ def get_package_selection_extensions(): :rtype: OrderedDict """ - extensions = instantiate_extensions(__name__) + if group_name is None: + group_name = __name__ + extensions = instantiate_extensions(group_name) for name, extension in extensions.items(): extension.PACKAGE_SELECTION_NAME = name return order_extensions_by_priority(extensions) diff --git a/colcon_core/prefix_path/__init__.py b/colcon_core/prefix_path/__init__.py index 15aae0b2e..4fa34eb88 100644 --- a/colcon_core/prefix_path/__init__.py +++ b/colcon_core/prefix_path/__init__.py @@ -40,7 +40,7 @@ def extend_prefix_path(self, paths): raise NotImplementedError() -def get_prefix_path_extensions(): +def get_prefix_path_extensions(*, group_name=None): """ Get the available prefix path extensions. @@ -49,7 +49,9 @@ def get_prefix_path_extensions(): :rtype: OrderedDict """ - extensions = instantiate_extensions(__name__) + if group_name is None: + group_name = __name__ + extensions = instantiate_extensions(group_name) for name, extension in extensions.items(): extension.PREFIX_PATH_NAME = name return order_extensions_grouped_by_priority(extensions) diff --git a/colcon_core/shell/__init__.py b/colcon_core/shell/__init__.py index faa103ff7..7924b7953 100644 --- a/colcon_core/shell/__init__.py +++ b/colcon_core/shell/__init__.py @@ -273,7 +273,7 @@ async def generate_command_environment( raise NotImplementedError() -def get_shell_extensions(): +def get_shell_extensions(*, group_name=None): """ Get the available shell extensions. @@ -282,7 +282,9 @@ def get_shell_extensions(): :rtype: OrderedDict """ - extensions = instantiate_extensions(__name__) + if group_name is None: + group_name = __name__ + extensions = instantiate_extensions(group_name) for name, extension in extensions.items(): extension.SHELL_NAME = name return order_extensions_grouped_by_priority(extensions) @@ -593,7 +595,7 @@ def find_installed_packages(self, install_base: Path): raise NotImplementedError() -def get_find_installed_packages_extensions(): +def get_find_installed_packages_extensions(*, group_name=None): """ Get the available package identification extensions. @@ -602,7 +604,10 @@ def get_find_installed_packages_extensions(): :rtype: OrderedDict """ - extensions = instantiate_extensions(__name__ + '.find_installed_packages') + if group_name is None: + group_name = __name__ + extensions = instantiate_extensions( + group_name + '.find_installed_packages') for name, extension in extensions.items(): extension.PACKAGE_IDENTIFICATION_NAME = name return order_extensions_grouped_by_priority(extensions) diff --git a/colcon_core/task/python/test/__init__.py b/colcon_core/task/python/test/__init__.py index 74a5ed2b8..a01ec4784 100644 --- a/colcon_core/task/python/test/__init__.py +++ b/colcon_core/task/python/test/__init__.py @@ -137,7 +137,7 @@ async def step(self): raise NotImplementedError() -def get_python_testing_step_extensions(): +def get_python_testing_step_extensions(*, group_name=None): """ Get the available Python testing step extensions. @@ -145,8 +145,9 @@ def get_python_testing_step_extensions(): :rtype: OrderedDict """ - extensions = instantiate_extensions( - 'colcon_core.python_testing', unique_instance=False) + if group_name is None: + group_name = 'colcon_core.python_testing' + extensions = instantiate_extensions(group_name, unique_instance=False) for name in list(extensions.keys()): extension = extensions[name] extension.STEP_TYPE = name diff --git a/colcon_core/verb/__init__.py b/colcon_core/verb/__init__.py index 640dc218f..49913ba16 100644 --- a/colcon_core/verb/__init__.py +++ b/colcon_core/verb/__init__.py @@ -48,7 +48,7 @@ def main(self, *, context): raise NotImplementedError() -def get_verb_extensions(): +def get_verb_extensions(*, group_name=None): """ Get the available verb extensions. @@ -56,7 +56,9 @@ def get_verb_extensions(): :rtype: OrderedDict """ - extensions = instantiate_extensions(__name__) + if group_name is None: + group_name = __name__ + extensions = instantiate_extensions(group_name) for name, extension in extensions.items(): extension.VERB_NAME = name return order_extensions_by_name(extensions)