diff options
| author | Ulf Magnusson <ulfalizer@gmail.com> | 2019-06-03 01:55:50 +0200 |
|---|---|---|
| committer | Ulf Magnusson <ulfalizer@gmail.com> | 2019-06-03 06:50:06 +0200 |
| commit | bf36f5de0f49d56975b1a844e25484ec385dc971 (patch) | |
| tree | 258589b5bbf8a64ced24c27bded8f4e08805106c /examples/merge_config.py | |
| parent | 55bc8c380869ea663092212e8fe388ad7abae596 (diff) | |
Improve warning control API (with backwards compatibility)
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.
Diffstat (limited to 'examples/merge_config.py')
| -rwxr-xr-x | examples/merge_config.py | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/examples/merge_config.py b/examples/merge_config.py index 6f60375..ef11d79 100755 --- a/examples/merge_config.py +++ b/examples/merge_config.py @@ -82,7 +82,7 @@ if len(sys.argv) < 4: kconf = Kconfig(sys.argv[1]) # Enable warnings for assignments to undefined symbols -kconf.enable_undef_warnings() +kconf.warn_assign_undef = True # (This script uses alldefconfig as the base. Other starting states could be # set up here as well. The approach in examples/allnoconfig_simpler.py could @@ -91,8 +91,8 @@ kconf.enable_undef_warnings() # Disable warnings generated for multiple assignments to the same symbol within # a (set of) configuration files. Assigning a symbol multiple times might be # done intentionally when merging configuration files. -kconf.disable_override_warnings() -kconf.disable_redun_warnings() +kconf.warn_assign_override = False +kconf.warn_assign_redun = False # Create a merged configuration by loading the fragments with replace=False. # load_config() and write_config() returns a message to print. |
