From 0327db2e642800a1608b006cd6c569f7bca0ff5c Mon Sep 17 00:00:00 2001 From: Ulf Magnusson Date: Tue, 12 Jun 2018 01:58:41 +0200 Subject: Simplify allnoconfig.py and allyesconfig.py 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. --- allnoconfig.py | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) (limited to 'allnoconfig.py') diff --git a/allnoconfig.py b/allnoconfig.py index f7b9b64..1d14e97 100755 --- a/allnoconfig.py +++ b/allnoconfig.py @@ -20,16 +20,22 @@ import kconfiglib def main(): kconf = kconfiglib.standard_kconfig() - # Avoid warnings printed by Kconfiglib when assigning a value to a symbol that - # has no prompt. Such assignments never have an effect. + # Avoid warnings printed by Kconfiglib when assigning a value to a symbol + # that has no prompt. Such assignments never have an effect. + + # Avoid warnings that would otherwise get printed by Kconfiglib for the + # following: + # + # 1. Assigning a value to a symbol without a prompt, which never has any + # effect + # + # 2. Assigning values invalid for the type (only bool/tristate symbols + # accept 0/1/2, for n/m/y). The assignments will be ignored for other + # symbol types, which is what we want. kconf.disable_warnings() - # Small optimization - BOOL_TRI = (kconfiglib.BOOL, kconfiglib.TRISTATE) - for sym in kconf.defined_syms: - if sym.orig_type in BOOL_TRI: - sym.set_value(2 if sym.is_allnoconfig_y else 0) + sym.set_value(2 if sym.is_allnoconfig_y else 0) kconf.write_config(kconfiglib.standard_config_filename()) -- cgit v1.2.3