summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorUlf Magnusson <ulfalizer@gmail.com>2017-11-06 08:41:41 +0100
committerUlf Magnusson <ulfalizer@gmail.com>2017-11-06 08:41:41 +0100
commitcf117de31fc793db6ba5c67c9aa8af06b1e2f69f (patch)
treed9c81bcb93df9bf856df3a6f80fbe968b7ab6596
parentdda3a6d1a87a366de10ac635331c1ee982c85c41 (diff)
Get rid of Choice.default_selection
Was only used by allyesconfig.py. Easy to add back if needed at any point.
-rw-r--r--kconfiglib.py24
-rw-r--r--testsuite.py1
2 files changed, 7 insertions, 18 deletions
diff --git a/kconfiglib.py b/kconfiglib.py
index d116769..0d58ae2 100644
--- a/kconfiglib.py
+++ b/kconfiglib.py
@@ -2925,10 +2925,6 @@ class Choice(object):
WARNING: Do not assign directly to this. It will break things. Call
sym.set_value(2) on the choice symbol you want to select instead.
- default_selection:
- The symbol that would be selected by default, had the user not selected
- any symbol. Can be None for the same reasons as 'selected'.
-
user_value:
The value (mode) selected by the user through Choice.set_value(). Either
0, 1, or 2, or None if the user hasn't selected a mode. See
@@ -3067,32 +3063,26 @@ class Choice(object):
self._cached_selection = None
return None
- # User choice available?
+ # Use the user selection if it's visible
if self.user_selection and self.user_selection.visibility == 2:
self._cached_selection = self.user_selection
return self.user_selection
- # Look at defaults
-
- self._cached_selection = self.default_selection
- return self._cached_selection
-
- @property
- def default_selection(self):
- """
- See the class documentation.
- """
- # Any default available?
+ # Otherwise, check if we have a default
for sym, cond in self.defaults:
+ # The default symbol must be visible too
if expr_value(cond) and sym.visibility:
+ self._cached_selection = sym
return sym
# Otherwise, pick the first visible symbol, if any
for sym in self.syms:
if sym.visibility:
+ self._cached_selection = sym
return sym
- # Couldn't find a default
+ # Couldn't find a selection
+ self._cached_selection = None
return None
def set_value(self, value):
diff --git a/testsuite.py b/testsuite.py
index b23ef23..f2a4eb7 100644
--- a/testsuite.py
+++ b/testsuite.py
@@ -1884,7 +1884,6 @@ def test_sanity(conf, arch):
choice.user_value
choice.assignable
choice.selection
- choice.default_selection
choice.type
choice.visibility