summaryrefslogtreecommitdiff
path: root/kconfiglib.py
diff options
context:
space:
mode:
authorUlf Magnusson <ulfalizer@gmail.com>2018-06-22 05:29:59 +0200
committerUlf Magnusson <ulfalizer@gmail.com>2018-06-22 06:02:47 +0200
commiteb6c21a9b33a2d6e2bed9882d4f930d0cab2f03b (patch)
tree2e03f85c7d25ed51d4db11a36f8d88362079bd5a /kconfiglib.py
parentf6eb4f435bc594aa58b8f8c066a9e2243c5c8330 (diff)
Turn MenuNode/Symbol/Choice.referenced() into a @property
Having it as a function is inconsistent, since all other read-only fields use properties. Oversight. Major version will be bumped to 7, though the function version wasn't in for long.
Diffstat (limited to 'kconfiglib.py')
-rw-r--r--kconfiglib.py45
1 files changed, 28 insertions, 17 deletions
diff --git a/kconfiglib.py b/kconfiglib.py
index 2741e10..dd99f14 100644
--- a/kconfiglib.py
+++ b/kconfiglib.py
@@ -2913,6 +2913,13 @@ class Symbol(object):
parent dependencies are automatically propagated to the conditions of
properties, so normally it's redundant to check the direct dependencies.
+ referenced:
+ A set() with 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.
+
env_var:
If the Symbol has an 'option env="FOO"' option, this contains the name
("FOO") of the environment variable. None for symbols without no
@@ -3334,17 +3341,14 @@ class Symbol(object):
self.user_value = None
self._rec_invalidate_if_has_prompt()
+ @property
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.
+ See the class documentation.
"""
res = set()
for node in self.nodes:
- res |= node.referenced()
+ res |= node.referenced
return res
@@ -3776,6 +3780,12 @@ class Choice(object):
direct_dep:
See Symbol.direct_dep.
+ referenced:
+ A set() with all symbols referenced in the properties and property
+ conditions of the choice.
+
+ Also includes dependencies inherited from surrounding menus and if's.
+
is_optional:
True if the choice has the 'optional' flag set on it and can be in
n mode.
@@ -3925,17 +3935,14 @@ class Choice(object):
self.user_value = self.user_selection = None
self._rec_invalidate()
+ @property
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.
+ See the class documentation.
"""
res = set()
for node in self.nodes:
- res |= node.referenced()
+ res |= node.referenced
return res
@@ -4175,6 +4182,13 @@ class MenuNode(object):
'visible if' dependencies are recursively propagated to the prompts of
symbols and choices within the menu.
+ referenced:
+ A set() with all symbols and choices referenced in the properties 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.
+
is_menuconfig:
Set to True if the children of the menu node should be displayed in a
separate menu. This is the case for the following items:
@@ -4226,13 +4240,10 @@ class MenuNode(object):
self.implies = []
self.ranges = []
+ @property
def referenced(self):
"""
- Returns a set() of all symbols and choices referenced in the properties
- 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.
+ See the class documentation.
"""
# self.dep is included to catch dependencies from a lone 'depends on'
# when there are no properties to propagate it to