[kernel] r9347 - people/waldi/dkt/lib/dkt/hooks

Bastian Blank waldi at alioth.debian.org
Wed Aug 22 18:09:04 UTC 2007


Author: waldi
Date: Wed Aug 22 18:09:04 2007
New Revision: 9347

Log:
lib/dkt/hooks: Update.


Modified:
   people/waldi/dkt/lib/dkt/hooks/interfaces.py
   people/waldi/dkt/lib/dkt/hooks/registry.py

Modified: people/waldi/dkt/lib/dkt/hooks/interfaces.py
==============================================================================
--- people/waldi/dkt/lib/dkt/hooks/interfaces.py	(original)
+++ people/waldi/dkt/lib/dkt/hooks/interfaces.py	Wed Aug 22 18:09:04 2007
@@ -9,7 +9,7 @@
 class IHookRunFirst(IHook):
     pass
 
-class IPrepare(IHookRunAll):
+class IImagePrepare(IHookRunAll):
     pass
 
 class IImageTask(IHookRunAll):

Modified: people/waldi/dkt/lib/dkt/hooks/registry.py
==============================================================================
--- people/waldi/dkt/lib/dkt/hooks/registry.py	(original)
+++ people/waldi/dkt/lib/dkt/hooks/registry.py	Wed Aug 22 18:09:04 2007
@@ -1,3 +1,29 @@
 class Registry(object):
-    pass
+    PRIORITY_REALLY_FIRST = -20
+    PRIORITY_FIRST = -10
+    PRIORITY_MIDDLE = 0
+    PRIORITY_LAST = 10
+    PRIORITY_REALLY_LAST = 20
+
+    def __init__(self):
+        self._modules = {}
+
+    def enable_module(self, name):
+        pass
+
+    def register_interface(self, name, interface, callable, priority = PRIORITY_MIDDLE, predecessors = (), successors = ()):
+        self._modules[name].interfaces[interface] = Interface(interface, callable, priority, predecessors, successors)
+
+    def register_module(self, name, enabled = False):
+        self._modules[name] = Module(name, enabled)
+
+    class Module(object):
+        def __init__(self, name, enabled):
+            self.name, self.enabled = name, enabled
+            self.interfaces = {}
+
+    class Interface(object):
+        def __init__(self, interface, callable, priority, predecessors, successors):
+            self.interface, self.callable, self.priority = interface, callable, priority
+            self.predecessors, self.successors = predecessors, successors
 



More information about the Kernel-svn-changes mailing list