[kernel] r9393 - in people/waldi/dkt/lib/dkt: . config hooks

Bastian Blank waldi at alioth.debian.org
Tue Aug 28 13:47:20 UTC 2007


Author: waldi
Date: Tue Aug 28 13:47:20 2007
New Revision: 9393

Log:
lib/dkt: Update.


Added:
   people/waldi/dkt/lib/dkt/hooks/runner.py
Modified:
   people/waldi/dkt/lib/dkt/__init__.py
   people/waldi/dkt/lib/dkt/config/__init__.py
   people/waldi/dkt/lib/dkt/hooks/__init__.py
   people/waldi/dkt/lib/dkt/hooks/interfaces.py

Modified: people/waldi/dkt/lib/dkt/__init__.py
==============================================================================
--- people/waldi/dkt/lib/dkt/__init__.py	(original)
+++ people/waldi/dkt/lib/dkt/__init__.py	Tue Aug 28 13:47:20 2007
@@ -0,0 +1 @@
+import config

Modified: people/waldi/dkt/lib/dkt/config/__init__.py
==============================================================================
--- people/waldi/dkt/lib/dkt/config/__init__.py	(original)
+++ people/waldi/dkt/lib/dkt/config/__init__.py	Tue Aug 28 13:47:20 2007
@@ -0,0 +1 @@
+import hooks

Modified: people/waldi/dkt/lib/dkt/hooks/__init__.py
==============================================================================
--- people/waldi/dkt/lib/dkt/hooks/__init__.py	(original)
+++ people/waldi/dkt/lib/dkt/hooks/__init__.py	Tue Aug 28 13:47:20 2007
@@ -0,0 +1,4 @@
+import registry
+
+default_registry = registry.Registry()
+register = default_registry.register

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	Tue Aug 28 13:47:20 2007
@@ -1,15 +1,19 @@
-from dkt.interfaces import Interface, implements
+from dkt.interface import Interface, implements
+from . import runner
 
-class IHool(Interface):
+class IHook(Interface):
     pass
 
 class IHookRunAll(IHook):
     pass
 
+class IHookRunAllArg(IHook):
+    pass
+
 class IHookRunFirst(IHook):
     pass
 
-class IImagePrepare(IHookRunAll):
+class IImagePrepare(IHookRunAllArg):
     def image_prepare():
         pass
 
@@ -19,11 +23,11 @@
 class ISystemTask(IHookRunAll):
     pass
 
-class IBootConfigPrepare(IHookRunAll):
+class IBootConfigPrepare(IHookRunAllArg):
     def boot_config_prepare():
         pass
 
-class IBootConfigPartition(IHookRunAll):
+class IBootConfigPartition(IHookRunAllArg):
     def boot_config_partition():
         pass
 

Added: people/waldi/dkt/lib/dkt/hooks/runner.py
==============================================================================
--- (empty file)
+++ people/waldi/dkt/lib/dkt/hooks/runner.py	Tue Aug 28 13:47:20 2007
@@ -0,0 +1,33 @@
+class RunAll(object):
+    def __init__(self, list):
+        self.list = list
+
+    def __call__(self, func, *args, **kw):
+        for i in self.list:
+            f = getattr(i, func)
+            f(*args, **kw)
+
+class RunAllArg(object):
+    def __init__(self, list):
+        self.list = list
+
+    def __call__(self, func, arg1, *args, **kw):
+        for i in self.list:
+            f = getattr(i, func)
+            ret = f(arg1, *args, **kw)
+            if ret is not None:
+                arg1 = ret
+        return ret
+
+class RunFirst(object):
+    def __init__(self, list):
+        self.list = list
+
+    def __call__(self, func, *args, **kw):
+        for i in self.list:
+            f = getattr(i, func)
+            ret = f(*args, **kw)
+            if ret is not None:
+                return ret
+        return None
+



More information about the Kernel-svn-changes mailing list