diff options
author | Ed Bartosh <ed.bartosh@linux.intel.com> | 2017-02-15 20:13:41 +0200 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2017-03-04 10:42:31 +0000 |
commit | efcd07fe17bf55441059b00a5becc3952e0a4075 (patch) | |
tree | aa66f8c3cde177c7a7bd23d23841ae0ae4ecf337 /scripts | |
parent | 87031c933047a37ddc26be3d04ea17b6e60ea10a (diff) | |
download | openembedded-core-efcd07fe17bf55441059b00a5becc3952e0a4075.tar.gz openembedded-core-efcd07fe17bf55441059b00a5becc3952e0a4075.tar.bz2 openembedded-core-efcd07fe17bf55441059b00a5becc3952e0a4075.zip |
wic: remove PluginMgr.get_plugin_methods
Call methods directly instead of getting them with
get_plugin_methods and then calling.
Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com>
Diffstat (limited to 'scripts')
-rw-r--r-- | scripts/lib/wic/help.py | 7 | ||||
-rw-r--r-- | scripts/lib/wic/partition.py | 20 | ||||
-rw-r--r-- | scripts/lib/wic/plugin.py | 17 | ||||
-rw-r--r-- | scripts/lib/wic/plugins/imager/direct.py | 10 |
4 files changed, 13 insertions, 41 deletions
diff --git a/scripts/lib/wic/help.py b/scripts/lib/wic/help.py index 196896c170..c08ad34ae5 100644 --- a/scripts/lib/wic/help.py +++ b/scripts/lib/wic/help.py @@ -373,12 +373,7 @@ DESCRIPTION This scheme is extensible - adding more hooks is a simple matter of adding more plugin methods to SourcePlugin and derived classes. - The code that then needs to call the plugin methods uses - plugin.get_plugin_methods() to find the method(s) needed by - the call; this is done by filling up a dict with keys containing - the method names of interest - on success, these will be filled in - with the actual methods. Please see the implementation for - examples and details. + Please see the implementation for details. """ wic_overview_help = """ diff --git a/scripts/lib/wic/partition.py b/scripts/lib/wic/partition.py index 1f384be450..adf44b743c 100644 --- a/scripts/lib/wic/partition.py +++ b/scripts/lib/wic/partition.py @@ -170,20 +170,16 @@ class Partition(): splitted = self.sourceparams.split(',') srcparams_dict = dict(par.split('=') for par in splitted if par) - partition_methods = ["do_configure_partition", "do_stage_partition", - "do_prepare_partition"] - - methods = PluginMgr.get_plugin_methods('source', self.source, - partition_methods) - methods["do_configure_partition"](self, srcparams_dict, creator, - cr_workdir, oe_builddir, bootimg_dir, - kernel_dir, native_sysroot) - methods["do_stage_partition"](self, srcparams_dict, creator, + plugin = PluginMgr.get_plugins('source')[self.source] + plugin.do_configure_partition(self, srcparams_dict, creator, cr_workdir, oe_builddir, bootimg_dir, kernel_dir, native_sysroot) - methods["do_prepare_partition"](self, srcparams_dict, creator, - cr_workdir, oe_builddir, bootimg_dir, - kernel_dir, rootfs_dir, native_sysroot) + plugin.do_stage_partition(self, srcparams_dict, creator, + cr_workdir, oe_builddir, bootimg_dir, + kernel_dir, native_sysroot) + plugin.do_prepare_partition(self, srcparams_dict, creator, + cr_workdir, oe_builddir, bootimg_dir, + kernel_dir, rootfs_dir, native_sysroot) # further processing required Partition.size to be an integer, make # sure that it is one diff --git a/scripts/lib/wic/plugin.py b/scripts/lib/wic/plugin.py index b45478cd9a..36a120bb1c 100644 --- a/scripts/lib/wic/plugin.py +++ b/scripts/lib/wic/plugin.py @@ -62,20 +62,3 @@ class PluginMgr: cls._loaded.append(ppath) return pluginbase.get_plugins(ptype) - - @classmethod - def get_plugin_methods(cls, ptype, pname, methods): - """ - The methods param is a dict with the method names to find. On - return, the dict values will be filled in with pointers to the - corresponding methods. If one or more methods are not found, - None is returned. - """ - result = {} - plugin = cls.get_plugins(ptype).get(pname) - for method in methods: - if not hasattr(plugin, method): - raise WicError("Unimplemented %s plugin interface for: %s" % - (method, pname)) - result[method] = getattr(plugin, method) - return result diff --git a/scripts/lib/wic/plugins/imager/direct.py b/scripts/lib/wic/plugins/imager/direct.py index 4ab195519a..7221648fc2 100644 --- a/scripts/lib/wic/plugins/imager/direct.py +++ b/scripts/lib/wic/plugins/imager/direct.py @@ -197,12 +197,10 @@ class DirectPlugin(ImagerPlugin): source_plugin = self.ks.bootloader.source disk_name = self.parts[0].disk if source_plugin: - name = "do_install_disk" - method = PluginMgr.get_plugin_methods('source', source_plugin, - [name])[name] - method(self._image, disk_name, self, self.workdir, - self.oe_builddir, self.bootimg_dir, - self.kernel_dir, self.native_sysroot) + plugin = PluginMgr.get_plugins('source')[source_plugin] + plugin.do_install_disk(self._image, disk_name, self, self.workdir, + self.oe_builddir, self.bootimg_dir, + self.kernel_dir, self.native_sysroot) full_path = self._image.path # Generate .bmap |