diff options
Diffstat (limited to 'scripts/lib/recipetool/create.py')
| -rw-r--r-- | scripts/lib/recipetool/create.py | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/scripts/lib/recipetool/create.py b/scripts/lib/recipetool/create.py index 3d5a373527..5c249ab0c6 100644 --- a/scripts/lib/recipetool/create.py +++ b/scripts/lib/recipetool/create.py | |||
| @@ -251,10 +251,22 @@ def create_recipe(args): | |||
| 251 | lines_after.append('') | 251 | lines_after.append('') |
| 252 | 252 | ||
| 253 | # Find all plugins that want to register handlers | 253 | # Find all plugins that want to register handlers |
| 254 | handlers = [] | 254 | logger.debug('Loading recipe handlers') |
| 255 | raw_handlers = [] | ||
| 255 | for plugin in plugins: | 256 | for plugin in plugins: |
| 256 | if hasattr(plugin, 'register_recipe_handlers'): | 257 | if hasattr(plugin, 'register_recipe_handlers'): |
| 257 | plugin.register_recipe_handlers(handlers) | 258 | plugin.register_recipe_handlers(raw_handlers) |
| 259 | # Sort handlers by priority | ||
| 260 | handlers = [] | ||
| 261 | for i, handler in enumerate(raw_handlers): | ||
| 262 | if isinstance(handler, tuple): | ||
| 263 | handlers.append((handler[0], handler[1], i)) | ||
| 264 | else: | ||
| 265 | handlers.append((handler, 0, i)) | ||
| 266 | handlers.sort(key=lambda item: (item[1], -item[2]), reverse=True) | ||
| 267 | for handler, priority, _ in handlers: | ||
| 268 | logger.debug('Handler: %s (priority %d)' % (handler.__class__.__name__, priority)) | ||
| 269 | handlers = [item[0] for item in handlers] | ||
| 258 | 270 | ||
| 259 | # Apply the handlers | 271 | # Apply the handlers |
| 260 | classes = [] | 272 | classes = [] |
