summaryrefslogtreecommitdiffstats
path: root/scripts/lib/wic/plugin.py
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/lib/wic/plugin.py')
-rw-r--r--scripts/lib/wic/plugin.py19
1 files changed, 10 insertions, 9 deletions
diff --git a/scripts/lib/wic/plugin.py b/scripts/lib/wic/plugin.py
index f04a0343d9..70d337789f 100644
--- a/scripts/lib/wic/plugin.py
+++ b/scripts/lib/wic/plugin.py
@@ -17,8 +17,8 @@
17 17
18import os 18import os
19import sys 19import sys
20import logging
20 21
21from wic import msger
22from wic import pluginbase 22from wic import pluginbase
23from wic.utils import errors 23from wic.utils import errors
24from wic.utils.misc import get_bitbake_var 24from wic.utils.misc import get_bitbake_var
@@ -30,6 +30,8 @@ PLUGIN_TYPES = ["imager", "source"]
30PLUGIN_DIR = "/lib/wic/plugins" # relative to scripts 30PLUGIN_DIR = "/lib/wic/plugins" # relative to scripts
31SCRIPTS_PLUGIN_DIR = "scripts" + PLUGIN_DIR 31SCRIPTS_PLUGIN_DIR = "scripts" + PLUGIN_DIR
32 32
33logger = logging.getLogger('wic')
34
33class PluginMgr(): 35class PluginMgr():
34 plugin_dirs = {} 36 plugin_dirs = {}
35 37
@@ -91,17 +93,16 @@ class PluginMgr():
91 if mod and mod != '__init__': 93 if mod and mod != '__init__':
92 if mod in sys.modules: 94 if mod in sys.modules:
93 #self.plugin_dirs[pdir] = True 95 #self.plugin_dirs[pdir] = True
94 msger.warning("Module %s already exists, skip" % mod) 96 logger.warning("Module %s already exists, skip", mod)
95 else: 97 else:
96 try: 98 try:
97 pymod = __import__(mod) 99 pymod = __import__(mod)
98 self.plugin_dirs[pdir] = True 100 self.plugin_dirs[pdir] = True
99 msger.debug("Plugin module %s:%s imported"\ 101 logger.debug("Plugin module %s:%s imported",
100 % (mod, pymod.__file__)) 102 mod, pymod.__file__)
101 except ImportError as err: 103 except ImportError as err:
102 msg = 'Failed to load plugin %s/%s: %s' \ 104 logger.warning('Failed to load plugin %s/%s: %s',
103 % (os.path.basename(pdir), mod, err) 105 os.path.basename(pdir), mod, err)
104 msger.warning(msg)
105 106
106 del sys.path[0] 107 del sys.path[0]
107 108
@@ -140,8 +141,8 @@ class PluginMgr():
140 if _source_name == source_name: 141 if _source_name == source_name:
141 for _method_name in methods: 142 for _method_name in methods:
142 if not hasattr(klass, _method_name): 143 if not hasattr(klass, _method_name):
143 msger.warning("Unimplemented %s source interface for: %s"\ 144 logger.warning("Unimplemented %s source interface for: %s",
144 % (_method_name, _source_name)) 145 _method_name, _source_name)
145 return None 146 return None
146 func = getattr(klass, _method_name) 147 func = getattr(klass, _method_name)
147 methods[_method_name] = func 148 methods[_method_name] = func