Skip to content

Commit ae8cf1b

Browse files
authored
Prioritize package_selection extensions (#475)
This change adds a PRIORITY attribute to package selection extensions, and considers it when ordering the extensions for use. This is a backwards-compatible change because all existing extensions will inherit the default priority value and will continue to be sorted alphabetically within that priority level.
1 parent 5d4a1bc commit ae8cf1b

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

colcon_core/package_selection/__init__.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
from colcon_core.package_identification \
1212
import get_package_identification_extensions
1313
from colcon_core.plugin_system import instantiate_extensions
14-
from colcon_core.plugin_system import order_extensions_by_name
14+
from colcon_core.plugin_system import order_extensions_by_priority
1515
from colcon_core.topological_order import topological_order_packages
1616

1717
logger = colcon_logger.getChild(__name__)
@@ -31,6 +31,9 @@ class PackageSelectionExtensionPoint:
3131
"""The version of the package selection extension interface."""
3232
EXTENSION_POINT_VERSION = '1.0'
3333

34+
"""The default priority of package selection extensions."""
35+
PRIORITY = 100
36+
3437
def add_arguments(self, *, parser):
3538
"""
3639
Add command line arguments specific to the package selection.
@@ -93,7 +96,7 @@ def get_package_selection_extensions():
9396
extensions = instantiate_extensions(__name__)
9497
for name, extension in extensions.items():
9598
extension.PACKAGE_SELECTION_NAME = name
96-
return order_extensions_by_name(extensions)
99+
return order_extensions_by_priority(extensions)
97100

98101

99102
def _add_package_selection_arguments(parser):

0 commit comments

Comments
 (0)