[kernel-team] 53/86: bin/split-common.py: Add script to split common options.

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 85a7e5cbc62b41dc3fef9607c97c82edca1268c4
Author: Bastian Blank <waldi at debian.org>
Date:   Thu Oct 29 10:39:41 2009 +0000

    bin/split-common.py: Add script to split common options.
    
    svn path=/people/waldi/utils/kconfigeditor2/; revision=14492
---
 utils/kconfigeditor2/bin/split-common.py | 51 ++++++++++++++++++++++++++++++++
 1 file changed, 51 insertions(+)

diff --git a/utils/kconfigeditor2/bin/split-common.py b/utils/kconfigeditor2/bin/split-common.py
new file mode 100755
index 0000000..70689dd
--- /dev/null
+++ b/utils/kconfigeditor2/bin/split-common.py
@@ -0,0 +1,51 @@
+#!/usr/bin/python2.6
+
+import itertools
+import optparse
+import os
+import sys
+
+
+class Main(object):
+    def __init__(self, *filenames):
+        from kconfigeditor.kconfig.config import File
+
+        input_files = [frozenset(File(open(i)).itervalues()) for i in filenames]
+
+        output_common = input_files[0] & input_files[1]
+
+        output_files = [i - output_common for i in input_files]
+
+        self.write('output-common', output_common)
+
+        for output, id in itertools.izip(output_files, xrange(1, len(output_files) + 1)):
+            self.write('output-part-%d' % id, output)
+
+    def write(self, filename, content):
+        f = open(filename, 'w')
+
+        items = [(i.name, i) for i in content]
+        items.sort(key=lambda a: a[0])
+        for key, value in items:
+            f.write(str(value) + '\n')
+
+        f.close()
+
+
+if __name__ == '__main__':
+    try:
+        import kconfigeditor
+    except ImportError:
+        sys.path.append(os.path.join(sys.path[0], '../lib'))
+
+    options = optparse.OptionParser(
+        usage = "%prog [OPTION]... CONFIG..."
+    )
+
+    opts, args = options.parse_args()
+
+    if len(args) < 1:
+        options.error("Too less arguments")
+
+    Main(*args)
+

-- 
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