diff options
| author | Ulf Magnusson <ulfalizer@gmail.com> | 2018-12-08 00:41:01 +0100 |
|---|---|---|
| committer | Ulf Magnusson <ulfalizer@gmail.com> | 2018-12-08 03:28:52 +0100 |
| commit | 7b4f72fa7a19b7c38312a6f6fd553ca45f04e9a6 (patch) | |
| tree | 55204b085afcb0316249eda97fee345694719b2e /oldconfig.py | |
| parent | 166be7d7684b4bd309661603a35710e0ed752680 (diff) | |
Make {load,write}_config(filename=None) implement the standard behavior
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.
Diffstat (limited to 'oldconfig.py')
| -rwxr-xr-x | oldconfig.py | 12 |
1 files changed, 3 insertions, 9 deletions
diff --git a/oldconfig.py b/oldconfig.py index 956bc07..66ee6be 100755 --- a/oldconfig.py +++ b/oldconfig.py @@ -27,7 +27,7 @@ import os import sys from kconfiglib import Kconfig, Symbol, Choice, BOOL, TRISTATE, HEX, \ - standard_kconfig, standard_config_filename + standard_kconfig # Python 2/3 compatibility hack if sys.version_info[0] < 3: @@ -42,12 +42,8 @@ def _main(): # visible symbols. global conf_changed - config_filename = standard_config_filename() - if not os.path.exists(config_filename): - sys.exit("{}: '{}' not found".format(sys.argv[0], config_filename)) - kconf = standard_kconfig() - kconf.load_config(config_filename) + kconf.load_config() while True: conf_changed = False @@ -58,9 +54,7 @@ def _main(): if not conf_changed: break - kconf.write_config(config_filename) - - print("Updated configuration written to '{}'".format(config_filename)) + kconf.write_config() def oldconfig(node): |
