[kernel] r14490 - people/waldi/utils/kconfigeditor2/lib/kconfigeditor/kconfig
Bastian Blank
waldi at alioth.debian.org
Thu Oct 29 09:54:50 UTC 2009
Author: waldi
Date: Thu Oct 29 09:54:49 2009
New Revision: 14490
Log:
lib/kconfigeditor/kconfig/config.py: Update file entries.
Modified:
people/waldi/utils/kconfigeditor2/lib/kconfigeditor/kconfig/config.py
Modified: people/waldi/utils/kconfigeditor2/lib/kconfigeditor/kconfig/config.py
==============================================================================
--- people/waldi/utils/kconfigeditor2/lib/kconfigeditor/kconfig/config.py Thu Oct 29 09:43:38 2009 (r14489)
+++ people/waldi/utils/kconfigeditor2/lib/kconfigeditor/kconfig/config.py Thu Oct 29 09:54:49 2009 (r14490)
@@ -130,7 +130,7 @@
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 @@
else:
raise RuntimeError, "Can't recognize %s" % line
+
class FileEntry(object):
- __slots__ = "name", "comments"
+ __slots__ = "name", "value", "comments"
+
+ def __init__(self, name, value, comments=[]):
+ self.name, self.value, self.comments = name, value, comments
- def __init__(self, name, comments):
- self.name, self.comments = name, 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
More information about the Kernel-svn-changes
mailing list