From 8efc358b6468834c7913cdf213e4aba05aeb14f7 Mon Sep 17 00:00:00 2001 From: Ulf Magnusson Date: Fri, 10 Aug 2018 03:15:33 +0200 Subject: menuconfig: Omit tristate value hint for int/string/hex defaults Previously, defaults for string/int/hex symbols showed up as e.g. '17 (value: "n")' in the symbol information, which looks confusing. Only display the hint for bool/tristate symbols to fix it. For "non-literal" symbols, _expr_str() still takes care of showing the value (e.g. 'FOO(="bar")'). --- menuconfig.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/menuconfig.py b/menuconfig.py index 2ef3bd7..dccac38 100755 --- a/menuconfig.py +++ b/menuconfig.py @@ -90,7 +90,7 @@ import re import textwrap from kconfiglib import Symbol, Choice, MENU, COMMENT, MenuNode, \ - BOOL, STRING, INT, HEX, UNKNOWN, \ + BOOL, TRISTATE, STRING, INT, HEX, UNKNOWN, \ AND, OR, NOT, \ expr_str, expr_value, split_expr, \ standard_sc_str_fn, \ @@ -1979,8 +1979,13 @@ def _defaults_info(sc): for val, cond in sc.defaults: s += " - " if isinstance(sc, Symbol): - s += '{} (value: "{}")' \ - .format(_expr_str(val), TRI_TO_STR[expr_value(val)]) + s += _expr_str(val) + + # Don't show the value hint 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 sc.orig_type in (BOOL, TRISTATE): + s += ' (value: "{}")'.format(TRI_TO_STR[expr_value(val)]) else: # Don't print the value next to the symbol name for choice # defaults, as it looks a bit confusing -- cgit v1.2.3