<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -103,11 +103,16 @@ class ControlConfig:
         self.share_property('project_name')
 
         all_plugins = list()
+        with_deps = dict()
         for plugin_name in self.plugin_names:
             logging.debug(&quot;initalizing plugin: %s&quot; % plugin_name)
             try:
                 plugin = self.create_plugin(plugin_name)
-                all_plugins.append(plugin)
+                if len(plugin.dependencies()) == 0:
+                    all_plugins.append(plugin)
+                else:
+                    dep = Dependency(plugin)
+                    dep.map(with_deps)
                 if isinstance(plugin, flashbake.plugins.AbstractMessagePlugin):
                     logging.debug(&quot;Message Plugin: %s&quot; % plugin_name)
                     # TODO add notion of dependency for ordering
@@ -131,6 +136,11 @@ class ControlConfig:
 
         for plugin in all_plugins:
             plugin.share_properties(self)
+            for dep in with_deps[plugin.plugin_spec]:
+                dep.satisfy(plugin, all_plugins)
+
+        if len(Dependency.all) &gt; 0:
+            logging.error('Unsatisfied dependencies!')
 
         for plugin in all_plugins:
             plugin.capture_properties(self)
@@ -225,6 +235,26 @@ class ControlConfig:
         return classobj
 
 
+class Dependency:
+    all = list()
+    def __init__(self, plugin):
+        self.plugin
+        self.dep_count = len(plugin.dependencies)
+
+    def map(self, dep_map):
+        for spec in self.plugin.dependencies():
+            if spec not in dep_map:
+                dep_map[spec] = list()
+            dep_map[spec].append(self)
+
+    def satisfy(self, plugin, all_plugins):
+        self.dep_count -= 1
+        if self.dep_count == 0:
+            pos = all_plugins.index(plugin)
+            all_plugins.insert(pos + 1)
+            all.remove(self)
+
+
 class HotFiles:
     &quot;&quot;&quot;
     Track the files as they are parsed and manipulated with regards to their git</diff>
      <filename>flashbake/__init__.py</filename>
    </modified>
    <modified>
      <diff>@@ -90,6 +90,12 @@ class AbstractPlugin():
         &quot;&quot;&quot; This method is optional. &quot;&quot;&quot;
         pass
 
+
+    def dependencies(self):
+        &quot;&quot;&quot; Optional method via which a plugin can express a dependency on another plugin. &quot;&quot;&quot;
+        return list()
+
+
     def __capture_property(self, config, name, type=None, required=False, default=None):
         &quot;&quot;&quot; Move a property, if present, from the ControlConfig to the daughter
             plugin. &quot;&quot;&quot;
@@ -140,7 +146,7 @@ class AbstractFilePlugin(AbstractPlugin):
         &quot;&quot;&quot; This method is required, it will asplode if not overridden by
             daughter classes. &quot;&quot;&quot;
         self.abstract()
-        
+
     def post_process(self, to_commit, hot_files, config):
         &quot;&quot;&quot; This method is optional, it will be run after status processing but before commit so the
             plugin may shuffle files into the commit. &quot;&quot;&quot;
@@ -156,7 +162,7 @@ class AbstractNotifyPlugin(AbstractPlugin):
             N.B. This method is required, it will asplode if not overridden by
             daughter classes. '''
         self.abstract()
-    
+
     def notify_commit(self, to_commit, hot_files, config):
         ''' Option method to notify when a commit is performed, probably most useful
             for services like desktop notifiers. '''</diff>
      <filename>flashbake/plugins/__init__.py</filename>
    </modified>
    <modified>
      <diff>@@ -1,6 +1,6 @@
-from flashbake.plugins import AbstractPlugin
+from flashbake.plugins import AbstractMessagePlugin
 
-class HelloDolly(AbstractPlugin):
+class HelloDolly(AbstractMessagePlugin):
     &quot;&quot;&quot; Sample plugin. &quot;&quot;&quot;
 
     def addcontext(self, message_file, config):</diff>
      <filename>plugins/hellodolly.py</filename>
    </modified>
    <modified>
      <diff>@@ -1,5 +1,15 @@
-import logging
 import flashbake.plugins
+import logging
+import unittest
+
+
+
+class FilesTestCase(unittest.TestCase):
+    def setUp(self):
+        self.config = ControlConfig()
+
+    def testrelative(self):
+        pass
 
 class MissingParent():
     def __init__(self, plugin_spec):
@@ -30,3 +40,30 @@ class WrongAddContext(flashbake.plugins.AbstractMessagePlugin):
     def __init__(self, plugin_spec):
         self.connectable = True
         self.addcontext = 1
+
+class Plugin1(flashbake.plugins.AbstractMessagePlugin):
+    &quot;&quot;&quot; Sample plugin. &quot;&quot;&quot;
+
+    def addcontext(self, message_file, config):
+        &quot;&quot;&quot; Stub. &quot;&quot;&quot;
+        pass
+
+class Plugin2(flashbake.plugins.AbstractMessagePlugin):
+    &quot;&quot;&quot; Sample plugin. &quot;&quot;&quot;
+    
+    def dependencies(self):
+        return ['test.plugins:Plugin1']
+
+    def addcontext(self, message_file, config):
+        &quot;&quot;&quot; Stub. &quot;&quot;&quot;
+        pass
+
+class Plugin3(flashbake.plugins.AbstractMessagePlugin):
+    &quot;&quot;&quot; Sample plugin. &quot;&quot;&quot;
+    
+    def dependencies(self):
+        return ['test.plugins:Plugin1', 'text.plugins:Plugin2']
+
+    def addcontext(self, message_file, config):
+        &quot;&quot;&quot; Stub. &quot;&quot;&quot;
+        pass</diff>
      <filename>test/plugins.py</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>7dd68fbeb0918b4a7ced1816cbdaab2de116bfee</id>
    </parent>
  </parents>
  <author>
    <name>Thomas Gideon</name>
    <email>cmdln@thecommandline.net</email>
  </author>
  <url>http://github.com/commandline/flashbake/commit/f9dfe8866d479039ff5ef2e328dbd2b48dc087c8</url>
  <id>f9dfe8866d479039ff5ef2e328dbd2b48dc087c8</id>
  <committed-date>2009-11-06T14:12:31-08:00</committed-date>
  <authored-date>2009-11-06T14:12:31-08:00</authored-date>
  <message>wip, starting to stub in dependencies.</message>
  <tree>e36fb5416e61238f393d631eda13634be075724a</tree>
  <committer>
    <name>Thomas Gideon</name>
    <email>cmdln@thecommandline.net</email>
  </committer>
</commit>
