diff options
| author | Ulf Magnusson <ulfalizer@gmail.com> | 2012-12-06 17:01:09 +0100 |
|---|---|---|
| committer | Ulf Magnusson <ulfalizer@gmail.com> | 2012-12-06 17:01:29 +0100 |
| commit | c805e3143bada2df897927996ae23a469cf83eb3 (patch) | |
| tree | 38212ced8df505ee2814ac5b8d29460f0fa5e98b /examples/allnoconfig.py | |
| parent | 94fb111d02b95413f7c36d923dabd4ec1ca1c90e (diff) | |
Move examples into separate directory.
Diffstat (limited to 'examples/allnoconfig.py')
| -rw-r--r-- | examples/allnoconfig.py | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/examples/allnoconfig.py b/examples/allnoconfig.py new file mode 100644 index 0000000..2fe151d --- /dev/null +++ b/examples/allnoconfig.py @@ -0,0 +1,36 @@ +# 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). + +import kconfiglib +import sys + +conf = kconfiglib.Config(sys.argv[1]) + +while True: + 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(): + 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") |
