diff options
| author | Ulf Magnusson <ulfalizer@gmail.com> | 2018-04-19 08:29:59 +0200 |
|---|---|---|
| committer | Ulf Magnusson <ulfalizer@gmail.com> | 2018-04-19 08:38:44 +0200 |
| commit | 509e374dfcadbe04ba30fe8aeea372101e0b5502 (patch) | |
| tree | 4b6234ae217a3db62e6791ac7d717ae100b3b228 | |
| parent | 105c835e70a5bb80a256b3d10d1d03dee7bb23db (diff) | |
Add Choice.direct_dep field
Same as Symbol.direct_dep (OR of node dependencies from all definition
locations). It's handy to have available when generating information
about choices.
| -rw-r--r-- | kconfiglib.py | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/kconfiglib.py b/kconfiglib.py index 487fd56..e014481 100644 --- a/kconfiglib.py +++ b/kconfiglib.py @@ -1963,14 +1963,18 @@ class Kconfig(object): name = self._next_token() if name is None: choice = Choice() + choice.direct_dep = self.n + self._choices.append(choice) else: # Named choice choice = self.named_choices.get(name) if not choice: choice = Choice() - self._choices.append(choice) choice.name = name + choice.direct_dep = self.n + + self._choices.append(choice) self.named_choices[name] = choice choice.kconfig = self @@ -2266,10 +2270,9 @@ class Kconfig(object): else node.parent.dep) if isinstance(node.item, (Symbol, Choice)): - if isinstance(node.item, Symbol): - # See the class documentation - node.item.direct_dep = \ - self._make_or(node.item.direct_dep, node.dep) + # See the Symbol/Choice class documentation + node.item.direct_dep = \ + self._make_or(node.item.direct_dep, node.dep) # Set the prompt, with dependencies propagated if node.prompt: @@ -3547,6 +3550,9 @@ class Choice(object): Note that 'depends on' and parent dependencies are propagated to 'default' conditions. + direct_dep: + See Symbol.direct_dep. + is_optional: True if the choice has the 'optional' flag set on it and can be in n mode. @@ -3561,6 +3567,7 @@ class Choice(object): "_dependents", "_was_set", "defaults", + "direct_dep", "is_constant", "is_optional", "kconfig", @@ -3758,6 +3765,7 @@ class Choice(object): """ # These attributes are always set on the instance from outside and # don't need defaults: + # direct_dep # kconfig self.orig_type = UNKNOWN |
