diff options
| author | Ulf Magnusson <ulfalizer@gmail.com> | 2018-08-23 02:43:00 +0200 |
|---|---|---|
| committer | Ulf Magnusson <ulfalizer@gmail.com> | 2018-08-24 01:01:36 +0200 |
| commit | 13884e934ec8eda928234c6506ae27f0334ec31b (patch) | |
| tree | 0f42365dad68240c5ebe0d81f7a7327affd1bf20 /menuconfig.py | |
| parent | 4b8805df373abebdf8e940b9511b2602640ff518 (diff) | |
Show include paths in menuconfig symbol information
Add a MenuNode.include_path attribute that holds a tuple of
(filename, linenr) tuples, giving the locations of the 'source'
statements via which the node's Kconfig file was included, starting from
the top-level Kconfig file.
Use MenuNode.include_path to give the include path for symbols and other
items in the help display in the menuconfig interface. This is useful
for figuring out how Kconfig files are organized, and when reorganizing
things.
Diffstat (limited to 'menuconfig.py')
| -rwxr-xr-x | menuconfig.py | 25 |
1 files changed, 17 insertions, 8 deletions
diff --git a/menuconfig.py b/menuconfig.py index 8f5dbe0..8c575b5 100755 --- a/menuconfig.py +++ b/menuconfig.py @@ -2075,22 +2075,31 @@ def _select_imply_info(sym): def _kconfig_def_info(item): # Returns a string with the definition of 'item' in Kconfig syntax, - # together with the definition location(s) + # together with the definition location(s) and their include and menu paths nodes = [item] if isinstance(item, MenuNode) else item.nodes s = "Kconfig definition{}, with propagated dependencies\n" \ .format("s" if len(nodes) > 1 else "") - s += (len(s) - 1)*"=" + "\n\n" - - s += "\n\n".join("At {}:{}, in menu {}:\n\n{}".format( - node.filename, node.linenr, _menu_path_info(node), - textwrap.indent(node.custom_str(_name_and_val_str), - " ")) - for node in nodes) + s += (len(s) - 1)*"=" + + for node in nodes: + s += "\n\n" \ + "At {}:{}\n" \ + "Included via {}\n" \ + "Menu path: {}\n\n" \ + "{}" \ + .format(node.filename, node.linenr, + _include_path_info(node), + _menu_path_info(node), + textwrap.indent(node.custom_str(_name_and_val_str), " ")) return s +def _include_path_info(node): + return " -> ".join("{}:{}".format(filename, linenr) + for filename, linenr in node.include_path) + def _menu_path_info(node): # Returns a string describing the menu path leading up to 'node' |
