summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorUlf Magnusson <ulfalizer@gmail.com>2018-08-29 03:15:18 +0200
committerUlf Magnusson <ulfalizer@gmail.com>2018-08-29 03:15:42 +0200
commit088e17a47d8efaee06b1f5e2fabaa939dc70e798 (patch)
tree2c5c865ec24336a66c78f4a875adc53c55758b23
parente435ecc6f367a2d0f7159bd3c7c0f1aca8dbb982 (diff)
menuconfig: Simplify default value info code
Just checking whether the default value expression is a single symbol correctly handles the string/int/hex cases too, because that case will always hit for those. D'oh.
-rwxr-xr-xmenuconfig.py13
1 files changed, 5 insertions, 8 deletions
diff --git a/menuconfig.py b/menuconfig.py
index 3ebf44e..2ef4769 100755
--- a/menuconfig.py
+++ b/menuconfig.py
@@ -2066,15 +2066,12 @@ def _defaults_info(sc):
if isinstance(sc, Symbol):
s += _expr_str(val)
- # Skip the value hint in these cases:
+ # Skip the tristate value hint if the expression is just a single
+ # symbol. _expr_str() already shows its value as a string.
#
- # - For string/int/hex symbols. The default can only be a single
- # symbol there, and it makes no sense to show its tristate value
- # (_expr_str() already shows its string value)
- #
- # - If the expression is just a symbol. _expr_str() already shows
- # its value in that case.
- if sc.orig_type in (BOOL, TRISTATE) and isinstance(val, tuple):
+ # This also avoids showing the tristate value for string/int/hex
+ # defaults, which wouldn't make any sense.
+ if isinstance(val, tuple):
s += ' (={})'.format(TRI_TO_STR[expr_value(val)])
else:
# Don't print the value next to the symbol name for choice