summaryrefslogtreecommitdiff
path: root/examples/print_refs.py
diff options
context:
space:
mode:
authorUlf Magnusson <ulfalizer@gmail.com>2012-12-06 17:01:09 +0100
committerUlf Magnusson <ulfalizer@gmail.com>2012-12-06 17:01:29 +0100
commitc805e3143bada2df897927996ae23a469cf83eb3 (patch)
tree38212ced8df505ee2814ac5b8d29460f0fa5e98b /examples/print_refs.py
parent94fb111d02b95413f7c36d923dabd4ec1ca1c90e (diff)
Move examples into separate directory.
Diffstat (limited to 'examples/print_refs.py')
-rw-r--r--examples/print_refs.py13
1 files changed, 13 insertions, 0 deletions
diff --git a/examples/print_refs.py b/examples/print_refs.py
new file mode 100644
index 0000000..b2d9f5f
--- /dev/null
+++ b/examples/print_refs.py
@@ -0,0 +1,13 @@
+# Prints the names of all symbols that reference a particular symbol. (There's
+# also a method get_selected_symbols() for determining just selection
+# relations.)
+
+import kconfiglib
+import sys
+
+conf = kconfiglib.Config(sys.argv[1])
+
+x86 = conf["X86"]
+for sym in conf:
+ if x86 in sym.get_referenced_symbols():
+ print sym.get_name()