[bitbake-devel] [RFC master][PATCH 3/4] bb.utils: let loaded plugins provide a plugin object

Christopher Larson kergoth at gmail.com
Sat Apr 30 19:40:59 UTC 2016


From: Christopher Larson <chris_larson at mentor.com>

This lets us avoid treating the module like an object, so no globals are
needed, if one chooses to do so.

Signed-off-by: Christopher Larson <chris_larson at mentor.com>
---
 lib/bb/utils.py | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/lib/bb/utils.py b/lib/bb/utils.py
index c54ff5b..5e735d3 100644
--- a/lib/bb/utils.py
+++ b/lib/bb/utils.py
@@ -1477,5 +1477,7 @@ def load_plugins(logger, plugins, pluginpath):
         if name != '__init__':
             plugin = load_plugin(name)
             if hasattr(plugin, 'plugin_init'):
-                plugin.plugin_init(plugins)
-            plugins.append(plugin)
+                obj = plugin.plugin_init(plugins)
+                plugins.append(obj or plugin)
+            else:
+                plugins.append(plugin)
-- 
2.8.0




More information about the bitbake-devel mailing list