From 11960409dc7b9dd50090c3c16b0ffd5f2a270031 Mon Sep 17 00:00:00 2001 From: Philip Craig Date: Thu, 12 Mar 2015 21:20:05 +1000 Subject: Statements in choices inherit menu/if deps This fixes the deps for the comment in drivers/usb/dwc2/Kconfig. --- kconfiglib.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'kconfiglib.py') diff --git a/kconfiglib.py b/kconfiglib.py index 0ea81b6..4d46f29 100644 --- a/kconfiglib.py +++ b/kconfiglib.py @@ -1060,7 +1060,7 @@ class Config(): choice.block = self._parse_block(line_feeder, T_ENDCHOICE, choice, - None, + deps, visible_if_deps) choice._determine_actual_symbols() -- cgit v1.2.3 From deaa62405116cc63dd7d03f4c5c58fa7ce7d91e6 Mon Sep 17 00:00:00 2001 From: Philip Craig Date: Thu, 12 Mar 2015 21:23:38 +1000 Subject: Add Symbol.is_allnoconfig_y() --- kconfiglib.py | 17 ++++++++++++++--- tests/Kmisc | 7 +++++++ testsuite.py | 8 ++++++++ 3 files changed, 29 insertions(+), 3 deletions(-) (limited to 'kconfiglib.py') diff --git a/kconfiglib.py b/kconfiglib.py index 4d46f29..152c7af 100644 --- a/kconfiglib.py +++ b/kconfiglib.py @@ -1325,9 +1325,12 @@ error, and you should e-mail kconfiglib@gmail.com. linenr) elif tokens.check(T_ALLNOCONFIG_Y): - self._warn("the 'allnoconfig_y' option is not supported.", - filename, - linenr) + if not isinstance(stmt, Symbol): + _parse_error(line, + "the 'allnoconfig_y' option is only valid for symbols.", + filename, + linenr) + stmt.allnoconfig_y = True else: _parse_error(line, "unrecognized option.", filename, linenr) @@ -2765,6 +2768,11 @@ class Symbol(Item, _HasVisibility): and sym.get_parent().get_selection() is sym'.""" return self.is_choice_symbol_ and self.parent.get_selection() is self + def is_allnoconfig_y(self): + """Returns True if the symbol has the 'allnoconfig_y' option set; + otherwise, returns False.""" + return self.allnoconfig_y + def __str__(self): """Returns a string containing various information about the symbol.""" return self.config._get_sym_or_choice_str(self) @@ -2862,6 +2870,9 @@ class Symbol(Item, _HasVisibility): # Does the symbol get its value from the environment? self.is_from_env = False + # Does the symbol have the 'allnoconfig_y' option set? + self.allnoconfig_y = False + def _invalidate(self): if self.is_special_: return diff --git a/tests/Kmisc b/tests/Kmisc index 725f661..d2e55b2 100644 --- a/tests/Kmisc +++ b/tests/Kmisc @@ -64,3 +64,10 @@ config FROM_ENV config FROM_ENV_MISSING string option env="MISSING_ENV_VAR" + +config NOT_ALLNOCONFIG_Y + bool "not allnoconfig_y" + +config ALLNOCONFIG_Y + bool "allnoconfig_y" + option allnoconfig_y diff --git a/testsuite.py b/testsuite.py index be0082e..1fe0f24 100644 --- a/testsuite.py +++ b/testsuite.py @@ -1195,6 +1195,13 @@ def run_selftests(): verify(not sym.is_choice_symbol(), "{0} should not be a choice symbol".format(sym_name)) + print "Testing is_allnoconfig_y()..." + + verify(not c["NOT_ALLNOCONFIG_Y"].is_allnoconfig_y(), + "NOT_ALLNOCONFIG_Y should not be allnoconfig_y") + verify(c["ALLNOCONFIG_Y"].is_allnoconfig_y(), + "ALLNOCONFIG_Y should be allnoconfig_y") + print "Testing UNAME_RELEASE value..." verify_value("UNAME_RELEASE", os.uname()[2]) @@ -1760,6 +1767,7 @@ def test_call_all(conf): s.is_defined() s.is_from_environment() s.is_modifiable() + s.is_allnoconfig_y() s.unset_user_value() # Check get_ref/def_location() sanity -- cgit v1.2.3