[linux] 04/17: Add script for reading a single config item
debian-kernel at lists.debian.org
debian-kernel at lists.debian.org
Sat Oct 31 22:18:15 UTC 2015
This is an automated email from the git hooks/post-receive script.
benh pushed a commit to branch master
in repository linux.
commit 3b781b1ad1232d9aff2bd0d8433f7119a9d64053
Author: Ben Hutchings <ben at decadent.org.uk>
Date: Thu Aug 13 15:22:18 2015 +0200
Add script for reading a single config item
---
debian/bin/getconfig.py | 27 +++++++++++++++++++++++++++
1 file changed, 27 insertions(+)
diff --git a/debian/bin/getconfig.py b/debian/bin/getconfig.py
new file mode 100755
index 0000000..e993f7c
--- /dev/null
+++ b/debian/bin/getconfig.py
@@ -0,0 +1,27 @@
+#!/usr/bin/python3
+
+import sys
+sys.path.append(sys.path[0] + "/../lib/python")
+
+from debian_linux.config import ConfigCoreDump
+
+section = tuple(s or None for s in sys.argv[1:-1])
+key = sys.argv[-1]
+config = ConfigCoreDump(fp=open("debian/config.defines.dump", "rb"))
+try:
+ value = config[section][key]
+except KeyError:
+ sys.exit(1)
+
+if isinstance(value, str):
+ # Don't iterate over it
+ print(value)
+else:
+ # In case it's a sequence, try printing each item
+ try:
+ for item in value:
+ print(item)
+ except TypeError:
+ # Otherwise use the default format
+ print(value)
+
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/kernel/linux.git
More information about the Kernel-svn-changes
mailing list