summaryrefslogtreecommitdiff
path: root/allnoconfig.py
AgeCommit message (Collapse)Author
2019-10-10Convert standard_kconfig() to argparse for better feedbackUlf Magnusson
Stuff like this is not the pinnacle of helpful design, and hides that the commands actually have long help texts (that can be viewed with pydoc): $ ./menuconfig.py --help [Errno 2] No such file or directory: '--help' Fix it by converting standard_kconfig() to argparse, and add a 'description' argument to it for the command-specific help text. --help now shows the same help text shown by pydoc, and some other error messages are improved as well. Also fix some copy-paste errors and outdated paths in the help texts for the all*config commands.
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-22Whitespace consistency nitUlf Magnusson
2019-03-22Convert some comments to module docstrings in utilitiesUlf Magnusson
This makes running pydoc(3) on the utilities helpful. Reuse the module docstring for the --help text for utilities that use argparse. Also fix some copy-paste errors in the all*config.py descriptions and clean up the language a bit. Piggyback removal of an optimization in allmodconfig.py that's pretty irrelevant now.
2019-03-06Use a consistent style in small utilitiesUlf Magnusson
Also remove some no longer used imports.
2019-01-15Update copyright years for 2019Ulf Magnusson
2018-12-08Make {load,write}_config(filename=None) implement the standard behaviorUlf Magnusson
Make the previously obligatory 'filename' argument to load_config() and write_config() default to None, and have that implement the behavior you'd usually want: read/write either KCONFIG_CONFIG or ".config" if unset, and read the 'option defconfig_list' configuration file if KCONFIG_CONFIG/".config" doesn't exist. For load_config(), filename=None also allows the configuration file to be missing without raising an error. load_config() returns True if a local configuration file was loaded, which is useful to check in the menuconfig (if no local configuration file exists, we always want to prompt for saving the configuration when exiting). Also add a 'verbose' argument (default True) to load_config() and read_config() that makes them print which files were read/written in filename=None mode. Also generalize olddefconfig.py and oldconfig.py to not require there to already be a local configuration file. This was a bit silly for olddefconfig.py in particular. Remove the examples/defconfig.py script. It's a duplicate of olddefconfig.py.
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-08-22Introduce Kconfig.unique_defined_syms and Kconfig.unique_choicesUlf Magnusson
These are the same as Kconfig.defined_syms and Kconfig.choices, except duplicates are removed. Kconfig order is still preserved. This is almost always what you want when iterating through symbols and choices, as it potentially saves work, avoids generating duplicates when writing output, and still preserves Kconfig order for readability. The old attributes will be kept for backwards compatibility (maybe there's some rare cases where they could be useful too). They're created internally anyway.
2018-07-11Massively speed up U-Boot parsingUlf Magnusson
U-Boot has a ton of definition locations for some symbols, causing a lot of redundant work when iterating over Kconfig.defined_syms in _build_dep(). Iterate over set(Kconfig.defined_syms) instead, wherever possible. This speeds up the U-Boot parsing time from 4 seconds to 0.6 seconds on my machine. Also update the bundled tools to iterate over set(Kconfig.defined_syms). The performance loss is negligible even for projects that don't use multiple definition locations. Update the documentation to clarify that symbols/choices defined in multiple locations appear multiple times in Kconfig.defined_syms/choices as well.
2018-06-19allnoconfig: Remove leftover commentUlf Magnusson
2018-06-12Simplify allnoconfig.py and allyesconfig.pyUlf Magnusson
We can rely on set_value() being a no-op when setting non-bool/tristate symbols to 0/1/2 (due to those values being invalid for other types). Remove some long duplicated comments too.
2018-06-11Mention KCONFIG_CONFIG in the all*config.py scriptsUlf Magnusson
This environment variable was inherited from the C tools. kconfiglib.standard_config_filename() looks at it.
2018-06-06Add license tags to scriptsUlf Magnusson
Everything's ISC.
2018-05-30Remove unused all{no,yes}config importsUlf Magnusson
No longer used after the tool helpers were added.
2018-05-30Add tool helper for loading/saving .config filesUlf Magnusson
Removes repeated KCONFIG_CONFIG boilerplate. Also make allyesconfig use KCONFIG_CONFIG when writing (oversight), and document the sys.exit() behavior for standard_kconfig().
2018-05-30Add tool helper for selecting the top-level KconfigUlf Magnusson
standard_kconfig() gets the top-level Kconfig file from the first command-line argument, defaulting to "Kconfig". This removes some boilerplate from tools.
2018-05-27Actually commit new allnoconfig.pyUlf Magnusson
Oops.