From e81a77bdb0687b62f91d7dc4d5b84b443808c0a7 Mon Sep 17 00:00:00 2001 From: Ulf Magnusson Date: Fri, 24 May 2019 12:14:31 +0200 Subject: Consistently put direct deps. last when propagating Preparation for some later additions. Previously, the 'visible if' deps appeared to the right of the 'depends on' deps. Now, the direct deps always appear last. With this change, the prompt tuple is only updated once for any given menu node too, which should be a tiny bit faster. --- kconfiglib.py | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) (limited to 'kconfiglib.py') 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 -- cgit v1.2.3