summaryrefslogtreecommitdiff
path: root/examples/allnoconfig.py
diff options
context:
space:
mode:
authorUlf Magnusson <ulfalizer@gmail.com>2012-12-08 07:36:57 +0100
committerUlf Magnusson <ulfalizer@gmail.com>2012-12-08 07:37:27 +0100
commit88fc64fbebd2d8344cb8af486e4dc732ed2542df (patch)
treeac4a84445170ed786a145a1445d5fd1253ec699a /examples/allnoconfig.py
parenta21d4585f2299df64cdb60af86c254aa4aa8da72 (diff)
Clarify allno/yesconfig.py.
Diffstat (limited to 'examples/allnoconfig.py')
-rw-r--r--examples/allnoconfig.py24
1 files changed, 10 insertions, 14 deletions
diff --git a/examples/allnoconfig.py b/examples/allnoconfig.py
index 2fe151d..7c22036 100644
--- a/examples/allnoconfig.py
+++ b/examples/allnoconfig.py
@@ -1,36 +1,32 @@
-# Works like allnoconfig. Verified to produce identical output to 'make
-# allnoconfig' for all ARCHes. The looping is done in case setting one symbol
-# to "n" allows other symbols to be set to "n" (due to dependencies).
+# Works like allnoconfig. Automatically verified by the testsuite to generate
+# identical output to 'make allnoconfig' for all ARCHes. The looping is done in
+# case setting one symbol to "n" allows other symbols to be set to "n" (due to
+# dependencies).
import kconfiglib
import sys
conf = kconfiglib.Config(sys.argv[1])
-while True:
+done = False
+while not done:
done = True
for sym in conf:
# Choices take care of themselves for allnoconfig, so we only need to
# worry about non-choice symbols
if not sym.is_choice_item():
+ # 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
+ # (currently) be changed, as well as for non-bool/tristate symbols.
lower_bound = sym.get_lower_bound()
-
- # If we can assign a lower value to the symbol (where "n", "m" and
- # "y" are ordered from lowest to highest), then do so.
- # lower_bound() returns None for symbols whose values cannot
- # (currently) be changed, as well as for non-bool, non-tristate
- # symbols.
if lower_bound is not None and \
kconfiglib.tri_less(lower_bound, sym.calc_value()):
sym.set_value(lower_bound)
-
# We just changed the value of some symbol. As this may affect
# other symbols, keep going.
done = False
- if done:
- break
-
conf.write_config(".config")