summaryrefslogtreecommitdiff
path: root/examples/print_config_tree.py
diff options
context:
space:
mode:
authorUlf Magnusson <ulfalizer@gmail.com>2019-03-06 02:10:20 +0100
committerUlf Magnusson <ulfalizer@gmail.com>2019-03-06 02:15:29 +0100
commit66557edc120faac569004ba2bc426c5ac6a1100b (patch)
tree58b44e89288715d2907671e18a341cf4df0cd40e /examples/print_config_tree.py
parent553cca8e7417ad863b923758e6d402296d05de9c (diff)
Use a consistent style in examples
Also remove some unused imports.
Diffstat (limited to 'examples/print_config_tree.py')
-rw-r--r--examples/print_config_tree.py11
1 files changed, 8 insertions, 3 deletions
diff --git a/examples/print_config_tree.py b/examples/print_config_tree.py
index 8356dcb..90e529f 100644
--- a/examples/print_config_tree.py
+++ b/examples/print_config_tree.py
@@ -54,18 +54,19 @@
import sys
from kconfiglib import Kconfig, \
- Symbol, Choice, MENU, COMMENT, \
+ Symbol, MENU, COMMENT, \
BOOL, TRISTATE, STRING, INT, HEX, UNKNOWN, \
- expr_value, \
- TRI_TO_STR
+ expr_value
# Add help description to output
WITH_HELP_DESC = False
+
def indent_print(s, indent):
print(" "*indent + s)
+
def value_str(sc):
"""
Returns the value part ("[*]", "<M>", "(foo)" etc.) of a menu entry.
@@ -99,6 +100,7 @@ def value_str(sc):
return "{" + tri_val_str + "}" # Gets a bit confusing with .format()
return "<{}>".format(tri_val_str)
+
def node_str(node):
"""
Returns the complete menu entry text for a menu node, or "" for invisible
@@ -151,6 +153,7 @@ def node_str(node):
return res
+
def print_menuconfig_nodes(node, indent):
"""
Prints a tree with all the menu entries rooted at 'node'. Child menu
@@ -166,6 +169,7 @@ def print_menuconfig_nodes(node, indent):
node = node.next
+
def print_menuconfig(kconf):
"""
Prints all menu entries for the configuration.
@@ -177,6 +181,7 @@ def print_menuconfig(kconf):
print_menuconfig_nodes(kconf.top_node.list, 0)
print("")
+
if __name__ == "__main__":
# Load Kconfig configuration files