[kernel] r14724 - people/waldi/utils/kconfigeditor2/bin
Bastian Blank
waldi at alioth.debian.org
Fri Dec 4 14:02:09 UTC 2009
Author: waldi
Date: Fri Dec 4 14:02:07 2009
New Revision: 14724
Log:
bin/show-enabled.py: Add.
Added:
people/waldi/utils/kconfigeditor2/bin/show-enabled.py (contents, props changed)
Added: people/waldi/utils/kconfigeditor2/bin/show-enabled.py
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ people/waldi/utils/kconfigeditor2/bin/show-enabled.py Fri Dec 4 14:02:07 2009 (r14724)
@@ -0,0 +1,56 @@
+#!/usr/bin/python2.6
+
+import itertools
+import optparse
+import os
+import sys
+
+
+class Option(object):
+ def __init__(self, name):
+ self.name = name
+ self.values = {}
+
+ def add(self, value, filename):
+ v = self.values.setdefault(value, [])
+ v.append(filename)
+
+
+class Main(object):
+ def __init__(self, package):
+ from kconfigeditor.package import Package
+
+ package = Package(package)
+
+ options = {}
+
+ for filename, data in package.items():
+ for name, value in data.file.iteritems():
+ option = options.setdefault(name, Option(name))
+ option.add(value, filename)
+
+ for name, option in sorted(options.iteritems()):
+ if len(option.values) > 1:
+ for value, filenames in option.values.iteritems():
+ print value
+ print 'in', ' '.join(sorted(filenames))
+ print
+
+
+if __name__ == '__main__':
+ try:
+ import kconfigeditor
+ except ImportError:
+ sys.path.append(os.path.join(sys.path[0], '../lib'))
+
+ options = optparse.OptionParser(
+ usage = "%prog [OPTION]... PACKAGE"
+ )
+
+ opts, args = options.parse_args()
+
+ if len(args) != 1:
+ options.error("Too less arguments")
+
+ Main(*args)
+
More information about the Kernel-svn-changes
mailing list