summaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorUlf Magnusson <ulfalizer@gmail.com>2017-10-28 00:46:00 +0200
committerUlf Magnusson <ulfalizer@gmail.com>2017-10-28 00:57:36 +0200
commit481bfd60d0b283f30b906d2edf8228aeb82e8492 (patch)
tree0e2451c219de37e71f4478596c9da32de545005a /examples
parent9b1cc0dbad8e19930d5e1c6365745e14c7fa6076 (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')
-rw-r--r--examples/allnoconfig.py4
-rw-r--r--examples/allyesconfig.py10
2 files changed, 7 insertions, 7 deletions
diff --git a/examples/allnoconfig.py b/examples/allnoconfig.py
index 8d41912..2348da4 100644
--- a/examples/allnoconfig.py
+++ b/examples/allnoconfig.py
@@ -8,7 +8,7 @@
#
# $ make [ARCH=<arch>] scriptconfig SCRIPT=Kconfiglib/examples/allnoconfig.py
-from kconfiglib import Config, Symbol, tri_less
+from kconfiglib import Config, Symbol, STR_TO_TRI
import sys
def do_allnoconfig(node):
@@ -27,7 +27,7 @@ def do_allnoconfig(node):
if (sym.choice is None and
not sym.is_allnoconfig_y and
sym.assignable and
- tri_less(sym.assignable[0], sym.value)):
+ STR_TO_TRI[sym.assignable[0]] < sym.tri_value):
# Yup, lower it
sym.set_value(sym.assignable[0])
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")