[kernel-team] 51/86: lib/kconfigeditor/kconfig/config.py: Update file entries.

debian-kernel at lists.debian.org debian-kernel at lists.debian.org
Mon Dec 21 00:34:58 UTC 2015


This is an automated email from the git hooks/post-receive script.

benh pushed a commit to branch benh/kconfigeditor2
in repository kernel-team.

commit 6597b56bf0dae67e9c579bc0cbe33757fd58a2dd
Author: Bastian Blank <waldi at debian.org>
Date:   Thu Oct 29 09:54:49 2009 +0000

    lib/kconfigeditor/kconfig/config.py: Update file entries.
    
    svn path=/people/waldi/utils/kconfigeditor2/; revision=14490
---
 .../lib/kconfigeditor/kconfig/config.py            | 41 ++++++++++------------
 1 file changed, 19 insertions(+), 22 deletions(-)

diff --git a/utils/kconfigeditor2/lib/kconfigeditor/kconfig/config.py b/utils/kconfigeditor2/lib/kconfigeditor/kconfig/config.py
index 065b8db..b93a0ca 100644
--- a/utils/kconfigeditor2/lib/kconfigeditor/kconfig/config.py
+++ b/utils/kconfigeditor2/lib/kconfigeditor/kconfig/config.py
@@ -130,7 +130,7 @@ class File(dict):
                 if value in ('y', 'm', 'n'):
                     entry = FileEntryTristate(option, value, comments)
                 else:
-                    entry = FileEntryString(option, value, comments)
+                    entry = FileEntry(option, value, comments)
                 self[option] = entry
                 comments = []
 
@@ -148,44 +148,41 @@ class File(dict):
             else:
                 raise RuntimeError, "Can't recognize %s" % line
 
+
 class FileEntry(object):
-    __slots__ = "name", "comments"
+    __slots__ = "name", "value", "comments"
 
-    def __init__(self, name, comments):
-        self.name, self.comments = name, comments
+    def __init__(self, name, value, comments=[]):
+        self.name, self.value, self.comments = name, value, comments
+
+    def __cmp__(self, other):
+        ret = cmp(self.name, other.name)
+        if ret:
+            return ret
+        return cmp(self.value, other.value)
+
+    def __str__(self):
+        return "CONFIG_%s=%s" % (self.name, self.value)
 
     def write(self):
         for comment in self.comments:
             yield '#. ' + comment
         yield str(self)
 
-# TODO
-class FileEntryString(FileEntry):
-    __slots__ = "value"
 
-    def __init__(self, name, value, comments):
-        super(FileEntryString, self).__init__(name, comments)
-        self.value = value
-
-    def __str__(self):
-        return "CONFIG_%s=%s" % (self.name, self.value)
-
-# TODO
 class FileEntryTristate(FileEntry):
-    __slots__ = "name", "value", "comments"
-
     VALUE_NO = 0
     VALUE_YES = 1
     VALUE_MOD = 2
 
-    def __init__(self, name, value, comments):
-        super(FileEntryTristate, self).__init__(name, comments)
+    def __init__(self, name, value, comments=[]):
         if value == 'n' or value is None:
-            self.value = self.VALUE_NO
+            value = self.VALUE_NO
         elif value == 'y':
-            self.value = self.VALUE_YES
+            value = self.VALUE_YES
         elif value == 'm':
-            self.value = self.VALUE_MOD
+            value = self.VALUE_MOD
+        super(FileEntryTristate, self).__init__(name, value, comments)
 
     def __str__(self):
         conf = "CONFIG_%s" % self.name

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/kernel/kernel-team.git



More information about the Kernel-svn-changes mailing list