summaryrefslogtreecommitdiff
path: root/oldconfig.py
AgeCommit message (Collapse)Author
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-05-19Remove some comments re. setup.py entry pointsUlf Magnusson
Only appeared in two of the scripts, and main() is such a common convention anyway.
2019-05-19Make .config.old easier to discoverUlf Magnusson
Mention that the old version of an overwritten configuration file is saved to <filename>.old in a few different places, to make it easier to discover.
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-14oldconfig: Style nitUlf Magnusson
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-10-01olddefconfig: Add scriptUlf Magnusson
Works like 'make olddefconfig', updating a configuration by filling in default values for all new symbols. This could also be accomplished by entering the 'menuconfig' interface and saving the configuration, but it's more awkward and less obvious. Piggyback two oldconfig changes: - Mention KCONFIG_CONFIG - Check if the .config file exists before parsing the Kconfig files, instead of after
2018-08-26oldconfig: Use Kconfig.node_iter() and clean upUlf Magnusson
Some general cleanup: - Handle the iteration with the new Kconfig.node_iter() helper. This makes some function so short that they become pointless. Have just main() + oldconfig(node) + small helper functions. - Use _name_and_loc_str(sc) for choices too, so that all locations get reported for named choices defined in multiple locations - Rewrite the intro to be less wordy and remove the sample session (leftover from when oldconfig.py was in examples/, and not that exciting) - Print "Updated configuration written to..." instead of "Configuration saved to..." - Various other nits
2018-08-25oldconfig: Fix help display command for choicesUlf Magnusson
'?' should display the help, like for symbols, not '??'. Oversight when the command was changed.
2018-06-22oldconfig: Put standard library imports firstUlf Magnusson
More common style.
2018-06-06Add license tags to scriptsUlf Magnusson
Everything's ISC.
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-27oldconfig: Move from examples/ to rootUlf Magnusson
All the packaged code will appear in the root.