diff options
| author | Ulf Magnusson <ulfalizer@gmail.com> | 2012-12-06 19:09:31 +0100 |
|---|---|---|
| committer | Ulf Magnusson <ulfalizer@gmail.com> | 2012-12-06 19:09:50 +0100 |
| commit | 713b98b6f27cb82c36d677d0ea2ebdcd7bcf455f (patch) | |
| tree | 4325c9ad4918f0a07e7bbcfbe084cddc4240799d /kconfiglib.py | |
| parent | b758526bfd9c13c9aaaf7383fddbff630446399a (diff) | |
Clarify and tighten up is_modifiable().
Diffstat (limited to 'kconfiglib.py')
| -rw-r--r-- | kconfiglib.py | 24 |
1 files changed, 16 insertions, 8 deletions
diff --git a/kconfiglib.py b/kconfiglib.py index 639620a..25b875a 100644 --- a/kconfiglib.py +++ b/kconfiglib.py @@ -2650,16 +2650,24 @@ class Symbol(Item, _HasVisibility): return self.ref_locations def is_modifiable(self): - """Returns True or False depending on if the value of symbol could be - modified by setting a user value with Symbol.set_value(). This - corresponds to symbols that would appear in the 'make menuconfig' - interface and not already be pinned to a specific value by being - selected. Returns False for special symbols (e.g. n, m and y).""" + """Returns True if the value of the symbol could be modified by calling + Symbol.set_value() and False otherwise. + + For bools and tristates, this corresponds to the symbol being visible + in the 'make menuconfig' interface and not already being pinned to a + specific value (e.g. because it is selected by another symbol). + + For strings and numbers, this corresponds to just being visible.""" if self.is_special_: return False - - return (self.config._eval_to_int(self._calc_visibility()) - - self.config._eval_to_int(self.config._eval_expr(self.rev_dep))) > 0 + if self.type in (BOOL, TRISTATE): + rev_dep = self.config._eval_expr(self.rev_dep) + # A bool selected to "m" gets promoted to "y" + if self.type == BOOL and rev_dep == "m": + rev_dep = "y" + return (self.config._eval_to_int(self._calc_visibility()) - + self.config._eval_to_int(rev_dep)) > 0 + return self._calc_visibility() != "n" def is_defined(self): """Returns False if the symbol is referred to in the Kconfig but never |
