diff options
| author | ulfalizer <ulfalizer@gmail.com> | 2015-03-13 01:04:08 +0100 |
|---|---|---|
| committer | ulfalizer <ulfalizer@gmail.com> | 2015-03-13 01:04:08 +0100 |
| commit | 5cc87664ae6fe0b05b6f2d3cc98aae864f9eafb0 (patch) | |
| tree | 9d475f7735d0ff7202ffee933fade87ee1d22de3 | |
| parent | cad5853418f4d080e6191e92f0f5d8042d0f8ea8 (diff) | |
| parent | 589d9b7fc305848df64b73eeac6bdfd76de7ce34 (diff) | |
Merge pull request #14 from philipc/linux-3.19
Fixes to make testsuite pass
| -rw-r--r-- | examples/allnoconfig.py | 8 | ||||
| -rw-r--r-- | examples/allnoconfig_simpler.py | 4 | ||||
| -rw-r--r-- | kconfiglib.py | 19 | ||||
| -rw-r--r-- | tests/Kmisc | 7 | ||||
| -rw-r--r-- | testsuite.py | 8 |
5 files changed, 40 insertions, 6 deletions
diff --git a/examples/allnoconfig.py b/examples/allnoconfig.py index d017355..3d3b3c1 100644 --- a/examples/allnoconfig.py +++ b/examples/allnoconfig.py @@ -13,9 +13,15 @@ while not done: done = True for sym in conf: + if sym.is_allnoconfig_y(): + if sym.get_value() != 'y': + sym.set_user_value('y') + # We just changed the value of some symbol. As this may affect + # other symbols, keep going. + done = False # Choices take care of themselves for allnoconfig, so we only need to # worry about non-choice symbols - if not sym.is_choice_symbol(): + elif not sym.is_choice_symbol(): # If we can assign a value to the symbol (where "n", "m" and "y" # are ordered from lowest to highest), then assign the lowest # value. lower_bound() returns None for symbols whose values cannot diff --git a/examples/allnoconfig_simpler.py b/examples/allnoconfig_simpler.py index f8f2a2c..f4b5c8d 100644 --- a/examples/allnoconfig_simpler.py +++ b/examples/allnoconfig_simpler.py @@ -22,7 +22,9 @@ conf = kconfiglib.Config(sys.argv[1]) conf.set_print_warnings(False) for sym in conf: - if sym.get_type() in (kconfiglib.BOOL, kconfiglib.TRISTATE): + if sym.is_allnoconfig_y(): + sym.set_user_value('y') + elif sym.get_type() in (kconfiglib.BOOL, kconfiglib.TRISTATE): sym.set_user_value("n") conf.write_config(".config") diff --git a/kconfiglib.py b/kconfiglib.py index 0ea81b6..152c7af 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() @@ -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 |
