diff options
author | necoro <> | 2007-07-07 02:27:31 +0000 |
---|---|---|
committer | necoro <> | 2007-07-07 02:27:31 +0000 |
commit | 91225d6ff5bc70cd76d0cf54f35a1cf6186b538b (patch) | |
tree | cd6514fdf518f4d54beafbbb64fefd8bcbc16bd5 /portato/plugin.py | |
parent | d1b6cf6e24b3f2ca310a07313a162bc8f790679f (diff) | |
download | portato-91225d6ff5bc70cd76d0cf54f35a1cf6186b538b.tar.gz portato-91225d6ff5bc70cd76d0cf54f35a1cf6186b538b.tar.bz2 portato-91225d6ff5bc70cd76d0cf54f35a1cf6186b538b.zip |
Some documentation work
Diffstat (limited to '')
-rw-r--r-- | portato/plugin.py | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/portato/plugin.py b/portato/plugin.py index da1e883..8a54c11 100644 --- a/portato/plugin.py +++ b/portato/plugin.py @@ -411,6 +411,8 @@ class PluginQueue: """Creates the lists of connects in a way, that all dependencies are fullfilled.""" unresolved_before = {} unresolved_after = {} + star_before = {} # should be _before_ all other + star_after = {} # should be _after_ all other for plugin in self.list: # plugins for hook in plugin.hooks: # hooks in plugin @@ -423,6 +425,11 @@ class PluginQueue: if connect.is_before_type(): if connect.depend_plugin is None: # no dependency -> straight add self.hooks[hook.hook][0].append(connect) + elif connect.depend_plugin == "*": + if not hook.hook in star_before: + star_before[hook.hook] = [] + + star_before[hook.hook].append(connect) else: named = [x.plugin.name for x in self.hooks[hook.hook][0]] if connect.depend_plugin in named: @@ -437,6 +444,11 @@ class PluginQueue: elif connect.is_after_type(): if connect.depend_plugin is None: # no dependency -> straight add self.hooks[hook.hook][2].append(connect) + elif connect.depend_plugin == "*": + if not hook.hook in star_after: + star_after[hook.hook] = [] + + star_after[hook.hook].append(connect) else: named = [x.plugin.name for x in self.hooks[hook.hook][2]] if connect.depend_plugin in named: @@ -457,13 +469,20 @@ class PluginQueue: self._resolve_unresolved(unresolved_before, unresolved_after) + for hook in star_before: + self.hooks[hook][0][0:0] = star_before[hook] # prepend the list + + for hook in star_after: + self.hooks[hook][2].extend(star_after[hook]) # append the list + + def _resolve_unresolved (self, before, after): def resolve(hook, list, idx, add): if not list: return changed = False - for connect in list: + for connect in list[:]: named = [x.plugin.name for x in self.hooks[hook][idx]] if connect.depend_plugin in named: changed = True |