diff options
| author | Ulf Magnusson <ulfalizer@gmail.com> | 2015-03-13 00:53:49 +0100 |
|---|---|---|
| committer | Ulf Magnusson <ulfalizer@gmail.com> | 2015-03-13 01:13:14 +0100 |
| commit | 668d3b80a310dfa2850f8b61bca3a15679da5ed1 (patch) | |
| tree | 6a639370d7058c71bc81d424887177f4d379e9c2 /examples | |
| parent | 5cc87664ae6fe0b05b6f2d3cc98aae864f9eafb0 (diff) | |
Fix examples/allnoconfig.py testsuite hang with v4.0-rc3.
Settings the user value to 'y' does not guarantee that the (actual)
value will become 'y', as the symbol's visibility still acts as an upper
bound on the value.
Diffstat (limited to 'examples')
| -rw-r--r-- | examples/allnoconfig.py | 16 | ||||
| -rw-r--r-- | examples/allnoconfig_simpler.py | 6 |
2 files changed, 11 insertions, 11 deletions
diff --git a/examples/allnoconfig.py b/examples/allnoconfig.py index 3d3b3c1..9423352 100644 --- a/examples/allnoconfig.py +++ b/examples/allnoconfig.py @@ -8,20 +8,22 @@ import sys conf = kconfiglib.Config(sys.argv[1]) +# Do an initial pass to give allnoconfig_y symbols the user value 'y'. It might +# be possible to handle this through "successive raising" similarly to the +# "successive lowering" below too, but keep it simple. +for sym in conf: + if sym.get_type() in (kconfiglib.BOOL, kconfiglib.TRISTATE) and \ + sym.is_allnoconfig_y(): + sym.set_user_value('y') + done = False 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 - elif not sym.is_choice_symbol(): + if not sym.is_choice_symbol() and not sym.is_allnoconfig_y(): # 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 f4b5c8d..f3cfe9a 100644 --- a/examples/allnoconfig_simpler.py +++ b/examples/allnoconfig_simpler.py @@ -22,9 +22,7 @@ conf = kconfiglib.Config(sys.argv[1]) conf.set_print_warnings(False) for sym in conf: - if sym.is_allnoconfig_y(): - sym.set_user_value('y') - elif sym.get_type() in (kconfiglib.BOOL, kconfiglib.TRISTATE): - sym.set_user_value("n") + if sym.get_type() in (kconfiglib.BOOL, kconfiglib.TRISTATE): + sym.set_user_value("y" if sym.is_allnoconfig_y() else "n") conf.write_config(".config") |
