From 589d9b7fc305848df64b73eeac6bdfd76de7ce34 Mon Sep 17 00:00:00 2001 From: Philip Craig Date: Thu, 12 Mar 2015 21:25:58 +1000 Subject: Use Symbol.is_allnoconfig_y() in the examples This is required for the 'make allnoconfig' tests. --- examples/allnoconfig.py | 8 +++++++- examples/allnoconfig_simpler.py | 4 +++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/examples/allnoconfig.py b/examples/allnoconfig.py index d017355..3d3b3c1 100644 --- a/examples/allnoconfig.py +++ b/examples/allnoconfig.py @@ -13,9 +13,15 @@ while not done: done = True for sym in conf: + if sym.is_allnoconfig_y(): + if sym.get_value() != 'y': + sym.set_user_value('y') + # We just changed the value of some symbol. As this may affect + # other symbols, keep going. + done = False # Choices take care of themselves for allnoconfig, so we only need to # worry about non-choice symbols - if not sym.is_choice_symbol(): + elif not sym.is_choice_symbol(): # If we can assign a value to the symbol (where "n", "m" and "y" # are ordered from lowest to highest), then assign the lowest # value. lower_bound() returns None for symbols whose values cannot diff --git a/examples/allnoconfig_simpler.py b/examples/allnoconfig_simpler.py index f8f2a2c..f4b5c8d 100644 --- a/examples/allnoconfig_simpler.py +++ b/examples/allnoconfig_simpler.py @@ -22,7 +22,9 @@ conf = kconfiglib.Config(sys.argv[1]) conf.set_print_warnings(False) for sym in conf: - if sym.get_type() in (kconfiglib.BOOL, kconfiglib.TRISTATE): + if sym.is_allnoconfig_y(): + sym.set_user_value('y') + elif sym.get_type() in (kconfiglib.BOOL, kconfiglib.TRISTATE): sym.set_user_value("n") conf.write_config(".config") -- cgit v1.2.3