diff options
| author | Martin Sivak <msivak@redhat.com> | 2008-04-18 15:58:46 +0200 |
|---|---|---|
| committer | Martin Sivak <msivak@redhat.com> | 2008-04-18 15:58:46 +0200 |
| commit | e8a8395ccc7f48f170bef7f348096f2a91f8d10d (patch) | |
| tree | 29659d8b31d2faffb3c1bcd88c68459e0b827c13 /pyfirstaidkit | |
| parent | 3c7dbfa8e712ea250f3da0aee2bc6d9eab5b265c (diff) | |
Flag system is able to list all known flags
Diffstat (limited to 'pyfirstaidkit')
| -rw-r--r-- | pyfirstaidkit/interpret.py | 13 | ||||
| -rw-r--r-- | pyfirstaidkit/plugins.py | 2 |
2 files changed, 15 insertions, 0 deletions
diff --git a/pyfirstaidkit/interpret.py b/pyfirstaidkit/interpret.py index ace5cea..5217939 100644 --- a/pyfirstaidkit/interpret.py +++ b/pyfirstaidkit/interpret.py @@ -29,6 +29,7 @@ class RunDependencies(object): """Encapsulate flags used to control the dependencies between plugins""" def __init__(self): self._provide = set() + self._known = set() def provide(self, id, setactionflag = True): """Add flag""" @@ -52,6 +53,18 @@ class RunDependencies(object): """Return True if flag is present, otherwise false""" return id in self._provide + def introduce(self, s): + """Notifies the system about dependency names used in the plugins, so we can list them in help""" + self._known = self._known.union(s) + + def known(self): + """Returns list of known flags""" + return list(self._known) + + def valid(self): + """Returns list of valid/provided flags""" + return list(self._provide) + class Tasker: """The main interpret of tasks described in Config object""" diff --git a/pyfirstaidkit/plugins.py b/pyfirstaidkit/plugins.py index 805667f..6bef7da 100644 --- a/pyfirstaidkit/plugins.py +++ b/pyfirstaidkit/plugins.py @@ -465,6 +465,8 @@ class PluginSystem(object): level = PLUGINSYSTEM, origin = self) moduleinfo = imp.find_module(m, [path]) module = imp.load_module(".".join([FirstAidKit.__name__, m]), *moduleinfo) + self._deps.introduce(module.get_plugin().getDeps()) #notify the dependency system about all used dependencies + self._deps.introduce(module.get_plugin().getConflicts()) #notify the dependency system about all used reverse-dependencies self._plugins[m] = module self._reporting.debug("Module %s successfully imported with basedir %s" % (m, os.path.dirname(module.__file__)), level = PLUGINSYSTEM, origin = self) |
