summaryrefslogtreecommitdiff
path: root/examples/merge_config.py
AgeCommit message (Collapse)Author
2019-06-03Improve warning control API (with backwards compatibility)Ulf Magnusson
A wart of the warning control API (enable/disable_*_warnings()) is that the current warning settings can't be queried. Querying warning settings is useful in functions that want to temporarily enable/disable some warning and then put things back to how they were. kconfiglib.load_allconfig() ran into this, for example. Make the internal warning control variables public (improve the naming at the same time), and encourage just setting them directly. Keep the old API for backwards compatibility. Also remove _warn_redun_assign() and _warn_override(). They're trivial and were called in a single place.
2019-06-03Have load_config() and write_(min_)config() return messagesUlf Magnusson
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).
2019-03-06Use a consistent style in examplesUlf Magnusson
Also remove some unused imports.
2018-11-21Link Zephyr's kconfig.py from merge_config.py exampleUlf Magnusson
Helps to have a fancier example too.
2018-11-17Add support for KCONFIG_ALLCONFIGUlf Magnusson
This allows some symbol values to be forced while running all{def,no,yes,mod}config.py. See Documentation/kbuild/kconfig.txt in the Linux kernel. Add a helper function load_allconfig() to Kconfiglib to avoid code duplication in the tools. Also add functions for enabling/disabling the warning that's generated when a symbol is assigned multiple times in a (set of) .config files and the values differ. It should be disabled when merging the KCONFIG_ALLCONFIG configuration file. Previously, only the warning generated when the assigned values are identical could be disabled. Disable all warnings related to assigning a symbol multiple times in examples/merge_config.py as well.
2018-09-27Use a consistent import style in the examplesUlf Magnusson
Do the PEP 8 ordering thingy with standard library imports first.
2018-05-27Simplify error exitsUlf Magnusson
Had missed sys.exit(msg).
2018-03-25merge_config.py: Clean up name_and_loc_str()Ulf Magnusson
- Rename to name_and_loc(), to be consistent with the kconfiglib.py version - Use a comment instead of a docstring. Shorten the description a bit too. - Piggyback a missing # in conf3 in the module docstring. Typo.
2018-02-07Give symbol locations in merge_config.py warningsUlf Magnusson
Helpful for debugging. Piggyback some small fixes: - Don't imply that merge_config.py is an executable file or that it only runs under Python 3. Remove the hashbang line and fix the example in the overview. - Add some #'s to the overview .config files that had accidentally been left out. - Fix a questionable sentence in oldconfig.py's name_and_loc_str() docstring.
2017-12-30Add merge_config.py exampleUlf Magnusson
Functions similarly to scripts/kconfig/merge_config.sh from the kernel. Came up in https://github.com/zephyrproject-rtos/zephyr/pull/5417.