diff options
author | Ola x Nilsson <ola.x.nilsson@axis.com> | 2016-10-25 13:03:34 +0200 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2016-12-13 22:55:20 +0000 |
commit | 14abe7982c94ec44737866f89274d80b03ffb08c (patch) | |
tree | 0b974d51f917b6c7403c5cb02b03fa8f7556e57c /scripts/lib/scriptutils.py | |
parent | 276523149914a75a939278b2e577383a2fdf3813 (diff) | |
download | poky-14abe7982c94ec44737866f89274d80b03ffb08c.tar.gz |
devtool: Load plugins in a well defined order
To allow devtool plugins in one layer to shadow another in a well
defined way, first search BBPATH/lib/devtool directories and then
scripts/lib/devool and load only the first found.
The previous search and load loop would load all found plugins with the
ones found later replacing any found before.
(From OE-Core rev: 1b2b8a0a80de17ea053002fdd124055d2798029a)
Signed-off-by: Ola x Nilsson <ola.x.nilsson@axis.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'scripts/lib/scriptutils.py')
-rw-r--r-- | scripts/lib/scriptutils.py | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/scripts/lib/scriptutils.py b/scripts/lib/scriptutils.py index 5ccc027968..27d82b62b8 100644 --- a/scripts/lib/scriptutils.py +++ b/scripts/lib/scriptutils.py | |||
@@ -52,10 +52,14 @@ def load_plugins(logger, plugins, pluginpath): | |||
52 | if fp: | 52 | if fp: |
53 | fp.close() | 53 | fp.close() |
54 | 54 | ||
55 | def plugin_name(filename): | ||
56 | return os.path.splitext(os.path.basename(filename))[0] | ||
57 | |||
58 | known_plugins = [plugin_name(p.__name__) for p in plugins] | ||
55 | logger.debug('Loading plugins from %s...' % pluginpath) | 59 | logger.debug('Loading plugins from %s...' % pluginpath) |
56 | for fn in glob.glob(os.path.join(pluginpath, '*.py')): | 60 | for fn in glob.glob(os.path.join(pluginpath, '*.py')): |
57 | name = os.path.splitext(os.path.basename(fn))[0] | 61 | name = plugin_name(fn) |
58 | if name != '__init__': | 62 | if name != '__init__' and name not in known_plugins: |
59 | plugin = load_plugin(name) | 63 | plugin = load_plugin(name) |
60 | if hasattr(plugin, 'plugin_init'): | 64 | if hasattr(plugin, 'plugin_init'): |
61 | plugin.plugin_init(plugins) | 65 | plugin.plugin_init(plugins) |