summaryrefslogtreecommitdiffstats
path: root/pyfirstaidkit/plugins.py
diff options
context:
space:
mode:
authorJoel Andres Granados <jgranado@redhat.com>2008-03-14 11:24:23 +0100
committerJoel Andres Granados <jgranado@redhat.com>2008-03-14 11:24:23 +0100
commit9336abca3dea390727c32f8b4cc53aad4dfb94ef (patch)
tree283c59bfe0ebdfacef258364c18db2bb4c146ae2 /pyfirstaidkit/plugins.py
parent220236c2e68948cfd2b8810a0092fa71b6d51bf9 (diff)
downloadfirstaidkit-9336abca3dea390727c32f8b4cc53aad4dfb94ef.tar.gz
firstaidkit-9336abca3dea390727c32f8b4cc53aad4dfb94ef.tar.xz
firstaidkit-9336abca3dea390727c32f8b4cc53aad4dfb94ef.zip
improve readability of code
Diffstat (limited to 'pyfirstaidkit/plugins.py')
-rw-r--r--pyfirstaidkit/plugins.py28
1 files changed, 17 insertions, 11 deletions
diff --git a/pyfirstaidkit/plugins.py b/pyfirstaidkit/plugins.py
index eb054fc..ecad3c4 100644
--- a/pyfirstaidkit/plugins.py
+++ b/pyfirstaidkit/plugins.py
@@ -366,13 +366,16 @@ class PluginSystem(object):
self._reporting.debug("Processing file: %s" % (f,), level = PLUGINSYSTEM, origin = self)
if os.path.isdir(fullpath) and os.path.isfile(os.path.join(path, f, "__init__.py")):
importlist.add(f)
- self._reporting.debug("Adding python module (directory): %s" % (f,), level = PLUGINSYSTEM, origin = self)
+ self._reporting.debug("Adding python module (directory): %s" % (f,),
+ level = PLUGINSYSTEM, origin = self)
elif os.path.isfile(fullpath) and (f[-3:]==".so" or f[-3:]==".py"):
importlist.add(f[:-3])
- self._reporting.debug("Adding python module (file): %s" % (f,), level = PLUGINSYSTEM, origin = self)
+ self._reporting.debug("Adding python module (file): %s" % (f,),
+ level = PLUGINSYSTEM, origin = self)
elif os.path.isfile(fullpath) and (f[-4:]==".pyc" or f[-4:]==".pyo"):
importlist.add(f[:-4])
- self._reporting.debug("Adding python module (compiled): %s" % (f,), level = PLUGINSYSTEM, origin = self)
+ self._reporting.debug("Adding python module (compiled): %s" % (f,),
+ level = PLUGINSYSTEM, origin = self)
#try to import the modules as FirstAidKit.plugins.modulename
for m in importlist:
@@ -381,25 +384,27 @@ class PluginSystem(object):
imp.acquire_lock()
try:
- self._reporting.debug("Importing module %s from %s" % (m, path), level = PLUGINSYSTEM, origin = self)
+ self._reporting.debug("Importing module %s from %s" % (m, path),
+ level = PLUGINSYSTEM, origin = self)
moduleinfo = imp.find_module(m, [path])
module = imp.load_module(".".join([FirstAidKit.__name__, m]), *moduleinfo)
finally:
imp.release_lock()
self._plugins[m] = module
- self._reporting.debug("Module %s successfully imported with basedir %s" % (m, os.path.dirname(module.__file__)),
- level = PLUGINSYSTEM, origin = self)
+ self._reporting.debug("Module %s successfully imported with basedir %s" %
+ (m, os.path.dirname(module.__file__)), level = PLUGINSYSTEM, origin = self)
def list(self):
"""Return the list of imported plugins"""
return self._plugins.keys()
-
+
def autorun(self, plugin, flow = None, dependencies = True):
"""Perform automated run of plugin with condition checking
-returns - True if conditions are fully satisfied
- False if there is something missing
- exception when some other error happens"""
+
+ returns - True if conditions are fully satisfied
+ False if there is something missing
+ exception when some other error happens"""
self._reporting.start(level = PLUGIN, origin = self, message = plugin)
@@ -417,7 +422,8 @@ returns - True if conditions are fully satisfied
Logger.info("Using %s flow" % flowName)
if flowName not in flows:
- self._reporting.exception(message = "Flow %s does not exist in plugin %s" % (flowName, plugin), level = PLUGINSYSTEM, origin = self)
+ self._reporting.exception(message = "Flow %s does not exist in plugin %s" %
+ (flowName, plugin), level = PLUGINSYSTEM, origin = self)
raise InvalidFlowNameException(flowName)
if dependencies: