diff options
| author | Ulf Magnusson <ulfalizer@gmail.com> | 2019-10-29 16:41:03 +0100 |
|---|---|---|
| committer | Ulf Magnusson <ulfalizer@gmail.com> | 2019-10-29 18:30:46 +0100 |
| commit | e1ccf19f9f5fc896dfeef15883d2cb455cbbb937 (patch) | |
| tree | 10cc86a8840315f0ec4c603abad7c4a2b840e2a6 /examples/merge_config.py | |
| parent | 2d1cb7eae230a560e02b7a8bdee2cf0526d169e2 (diff) | |
Add public helpers for generating "<name> (defined at ...)" strings
Have Symbol/Choice.name_and_loc return strings like
"MY_SYM (defined at foo:1, bar:2)"
"<choice> (defined at foo:4)"
I've added a function like that in at least four different scripts now,
so that's probably a sign that it's a worthwhile helper.
Clean up the tests/Klocation tests a bit while adding tests.
Diffstat (limited to 'examples/merge_config.py')
| -rwxr-xr-x | examples/merge_config.py | 14 |
1 files changed, 1 insertions, 13 deletions
diff --git a/examples/merge_config.py b/examples/merge_config.py index ef11d79..528e86c 100755 --- a/examples/merge_config.py +++ b/examples/merge_config.py @@ -104,18 +104,6 @@ print(kconf.write_config(sys.argv[2])) # Print warnings for symbols whose actual value doesn't match the assigned # value - -def name_and_loc(sym): - # Helper for printing symbol names and Kconfig file location(s) in warnings - - if not sym.nodes: - return sym.name + " (undefined)" - - return "{} (defined at {})".format( - sym.name, - ", ".join("{}:{}".format(node.filename, node.linenr) - for node in sym.nodes)) - for sym in kconf.defined_syms: # Was the symbol assigned to? if sym.user_value is not None: @@ -129,5 +117,5 @@ for sym in kconf.defined_syms: if user_value != sym.str_value: print("warning: {} was assigned the value '{}' but got the " "value '{}' -- check dependencies".format( - name_and_loc(sym), user_value, sym.str_value), + sym.name_and_loc, user_value, sym.str_value), file=sys.stderr) |
