diff options
| author | Ulf Magnusson <ulfalizer@gmail.com> | 2018-06-22 05:15:46 +0200 |
|---|---|---|
| committer | Ulf Magnusson <ulfalizer@gmail.com> | 2018-06-22 06:02:47 +0200 |
| commit | f6eb4f435bc594aa58b8f8c066a9e2243c5c8330 (patch) | |
| tree | 83f160db85f94330fa81fb8fba7121611edaf4aa /kconfiglib.py | |
| parent | 94e6db54b8c8411cead8cc4186aa9199a23d617e (diff) | |
Add Symbol/Choice.referenced() convenience methods
Returns the union of the MenuNode.referenced() sets for all the menu
nodes of the symbol/choice.
Diffstat (limited to 'kconfiglib.py')
| -rw-r--r-- | kconfiglib.py | 30 |
1 files changed, 29 insertions, 1 deletions
diff --git a/kconfiglib.py b/kconfiglib.py index d62c7a8..2741e10 100644 --- a/kconfiglib.py +++ b/kconfiglib.py @@ -3334,6 +3334,20 @@ class Symbol(object): self.user_value = None self._rec_invalidate_if_has_prompt() + def referenced(self): + """ + Returns a set() of all symbols and choices referenced in the properties + and property conditions of the symbol. + + Also includes dependencies inherited from surrounding menus and if's. + Choices appear in the dependencies of choice symbols. + """ + res = set() + for node in self.nodes: + res |= node.referenced() + + return res + def __repr__(self): """ Returns a string with information about the symbol (including its name, @@ -3911,6 +3925,20 @@ class Choice(object): self.user_value = self.user_selection = None self._rec_invalidate() + def referenced(self): + """ + Returns a set() of all symbols and choices referenced in the properties + and property conditions of the choice. + + Also includes dependencies inherited from surrounding menus and if's. + Choices appear in the dependencies of choice symbols. + """ + res = set() + for node in self.nodes: + res |= node.referenced() + + return res + def __repr__(self): """ Returns a string with information about the choice when it is evaluated @@ -4201,7 +4229,7 @@ class MenuNode(object): def referenced(self): """ Returns a set() of all symbols and choices referenced in the properties - and property conditions of this menu node. + and property conditions of the menu node. Also includes dependencies inherited from surrounding menus and if's. Choices appear in the dependencies of choice symbols. |
