summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--kconfiglib.py18
-rw-r--r--tests/Kstr5
-rw-r--r--testsuite.py10
3 files changed, 25 insertions, 8 deletions
diff --git a/kconfiglib.py b/kconfiglib.py
index 4a58669..2725787 100644
--- a/kconfiglib.py
+++ b/kconfiglib.py
@@ -3321,18 +3321,15 @@ class Kconfig(object):
cur = node.list
while cur:
- cur.dep = dep = self._make_and(cur.dep, basedep)
-
- # Propagate dependencies to prompt
- if cur.prompt:
- cur.prompt = (cur.prompt[0],
- self._make_and(cur.prompt[1], dep))
+ dep = cur.dep = self._make_and(cur.dep, basedep)
if cur.item.__class__ in _SYMBOL_CHOICE:
- # Propagate 'visible if' dependencies to the prompt
if cur.prompt:
+ # Propagate 'visible if' and dependencies to the prompt
cur.prompt = (cur.prompt[0],
- self._make_and(cur.prompt[1], visible_if))
+ self._make_and(
+ cur.prompt[1],
+ self._make_and(visible_if, dep)))
# Propagate dependencies to defaults
if cur.defaults:
@@ -3354,6 +3351,11 @@ class Kconfig(object):
cur.implies = [(target, self._make_and(cond, dep))
for target, cond in cur.implies]
+ elif cur.prompt: # Not a symbol/choice
+ # Propagate dependencies to the prompt. 'visible if' is only
+ # propagated to symbols/choices.
+ cur.prompt = (cur.prompt[0],
+ self._make_and(cur.prompt[1], dep))
cur = cur.next
diff --git a/tests/Kstr b/tests/Kstr
index 25c14db..58d25e6 100644
--- a/tests/Kstr
+++ b/tests/Kstr
@@ -36,6 +36,7 @@ if DEP3
menu "foo"
depends on DEP4
+ visible if VIS
config ADVANCED
help
@@ -43,6 +44,10 @@ config ADVANCED
depends on A || !B || (C && D) || !(E && F) || G = H || \
(I && !J && (K || L) && !(M || N) && O = P)
+config ADVANCED
+ # Used to verify that the direct dependencies appear to the right of VIS
+ prompt "prompt 4"
+
endmenu
endif
diff --git a/testsuite.py b/testsuite.py
index 175d278..c1690d3 100644
--- a/testsuite.py
+++ b/testsuite.py
@@ -554,6 +554,11 @@ config ADVANCED
depends on (A || !B || (C && D) || !(E && F) || G = H || (I && !J && (K || L) && !(M || N) && O = P)) && DEP4 && DEP3
help
second help text
+
+config ADVANCED
+ tristate
+ prompt "prompt 4" if VIS && DEP4 && DEP3
+ depends on DEP4 && DEP3
""")
verify_custom_str(c.syms["ADVANCED"], """
@@ -582,6 +587,11 @@ config ADVANCED
depends on ([A] || ![B] || ([C] && [D]) || !([E] && [F]) || [G] = [H] || ([I] && ![J] && ([K] || [L]) && !([M] || [N]) && [O] = [P])) && [DEP4] && [DEP3]
help
second help text
+
+config ADVANCED
+ tristate
+ prompt "prompt 4" if [VIS] && [DEP4] && [DEP3]
+ depends on [DEP4] && [DEP3]
""")