[kernel] r6721 - dists/trunk/linux-2.6/debian/lib/python/debian_linux

Bastian Blank waldi at costa.debian.org
Sun May 28 19:51:32 UTC 2006


Author: waldi
Date: Sun May 28 19:51:27 2006
New Revision: 6721

Modified:
   dists/trunk/linux-2.6/debian/lib/python/debian_linux/utils.py

Log:
debian/lib/python/debian_linux/utils.py: Support non control templates.


Modified: dists/trunk/linux-2.6/debian/lib/python/debian_linux/utils.py
==============================================================================
--- dists/trunk/linux-2.6/debian/lib/python/debian_linux/utils.py	(original)
+++ dists/trunk/linux-2.6/debian/lib/python/debian_linux/utils.py	Sun May 28 19:51:27 2006
@@ -75,11 +75,8 @@
         return '\n '.join(self.split('\n'))
 
 class templates(dict):
-    def __init__(self, dir = None):
-        if dir is None:
-            self.dir = "debian/templates"
-        else:
-            self.dir = dir
+    def __init__(self, dir = "debian/templates"):
+        self.dir = dir
 
     def __getitem__(self, key):
         try:
@@ -92,10 +89,17 @@
     def __setitem__(self, key, value):
         raise NotImplemented()
 
-    def _read(self, filename):
-        entries = []
+    def _read(self, name):
+        prefix, id = name.split('.', 1)
+        f = file("%s/%s.in" % (self.dir, name))
+
+        if prefix == 'control':
+            return self._read_control(f)
 
-        f = file("%s/%s.in" % (self.dir, filename))
+        return f.read()
+
+    def _read_control(self, f):
+        entries = []
 
         while True:
             e = debian.package()



More information about the Kernel-svn-changes mailing list