diff options
| author | Ulf Magnusson <ulfalizer@gmail.com> | 2017-10-28 00:46:00 +0200 |
|---|---|---|
| committer | Ulf Magnusson <ulfalizer@gmail.com> | 2017-10-28 00:57:36 +0200 |
| commit | 481bfd60d0b283f30b906d2edf8228aeb82e8492 (patch) | |
| tree | 0e2451c219de37e71f4478596c9da32de545005a /examples/allyesconfig.py | |
| parent | 9b1cc0dbad8e19930d5e1c6365745e14c7fa6076 (diff) | |
Nearly finalize API
Probably just some usability tweaks left. Having to do STR_TO_TRI[] for
comparisons against 'assignable' values is kinda ugly and confusing.
Diffstat (limited to 'examples/allyesconfig.py')
| -rw-r--r-- | examples/allyesconfig.py | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/examples/allyesconfig.py b/examples/allyesconfig.py index 32b302c..f91b6d7 100644 --- a/examples/allyesconfig.py +++ b/examples/allyesconfig.py @@ -18,7 +18,7 @@ # # $ make [ARCH=<arch>] scriptconfig SCRIPT=Kconfiglib/examples/allyesconfig.py -from kconfiglib import Config, Choice, tri_less +from kconfiglib import Config, Choice, STR_TO_TRI import sys conf = Config(sys.argv[1]) @@ -70,7 +70,7 @@ while 1: for sym in non_choice_syms: # See allnoconfig example. [-1] gives the last (highest) assignable # value. - if sym.assignable and tri_less(sym.value, sym.assignable[-1]): + if sym.assignable and sym.tri_value < STR_TO_TRI[sym.assignable[-1]]: sym.set_value(sym.assignable[-1]) no_changes = False @@ -79,7 +79,7 @@ while 1: for choice in choices: # Handle a choice whose visibility allows it to be in "y" mode - if choice.visibility == "y": + if choice.visibility == 2: selection = choice.default_selection # Does the choice have a default selection that we haven't already @@ -95,12 +95,12 @@ while 1: # This might happen if a choice depends on a symbol that can only be # "m", for example. - elif choice.visibility == "m": + elif choice.visibility == 1: for sym in choice.symbols: # Does the choice have a symbol that can be "m" that we haven't # already set to "m"? - if sym.user_value != "m" and "m" in sym.assignable: + if sym.user_tri_value != 1 and "m" in sym.assignable: # Yup, set it sym.set_value("m") |
