diff options
| author | Ulf Magnusson <ulfalizer@gmail.com> | 2019-06-02 18:15:59 +0200 |
|---|---|---|
| committer | Ulf Magnusson <ulfalizer@gmail.com> | 2019-06-03 06:50:06 +0200 |
| commit | 55bc8c380869ea663092212e8fe388ad7abae596 (patch) | |
| tree | 200d557c614845bd017de4e411c66c5c0b19fae5 /listnewconfig.py | |
| parent | 455e3661c6f50b088b35a3b2662052e7e2a24769 (diff) | |
Have load_config() and write_(min_)config() return messages
Hardcoding load_config() and write_(min_)config() to write any message
to stdout is awkward, because it means that the message can't be easily
reused when stdout is the wrong place to write it to (e.g. in
menuconfig/guiconfig). This gets extra bad now that there's also the "No
change to ..." message.
Modify load_config() and write_(min_)config() to return the message as a
string instead, and have them always return a message, instead of just
when 'filename' is None and verbose=True. This makes things flexible and
straightforward.
Use the new behavior in menuconfig.py and guiconfig.py. They now show
"No change to ..." when saving a file doesn't modify it.
Tools that want to write messages to stdout should now do
print(kconf.load_config()) / print(kconf.write_config()).
There's no clean way to preserve perfect backwards compatibility here,
but keep accepting the 'verbose' argument and print a deprecation
warning if a value is ever passed for it. That way, scripts will keep
running, though possibly with less output on stdout.
This changes the meaning of the load_config() return value as well,
though I suspect it was only ever used by the menuconfig/guiconfig
interfaces.
The new behavior applies for kconfiglib.VERSION >= (12, 0, 0).
Diffstat (limited to 'listnewconfig.py')
| -rwxr-xr-x | listnewconfig.py | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/listnewconfig.py b/listnewconfig.py index 06d0cf1..59de141 100755 --- a/listnewconfig.py +++ b/listnewconfig.py @@ -18,7 +18,9 @@ from kconfiglib import standard_kconfig, BOOL, TRISTATE, INT, HEX, STRING, \ def main(): kconf = standard_kconfig() - kconf.load_config() + # Make it possible to filter this message out + sys.stderr.write(kconf.load_config() + "\n") + for sym in kconf.unique_defined_syms: # Only show symbols that can be toggled. Choice symbols are a special # case in that sym.assignable will be (2,) (length 1) for visible |
