From ac8e93117935a7b586088bdfe92dd8a3f965f80a Mon Sep 17 00:00:00 2001 From: Angus Gratton Date: Fri, 31 Jan 2020 18:48:56 +1100 Subject: [PATCH] confgen: Avoid including invisible (due to target) choice items in kconfig.rst renames --- tools/kconfig_new/confgen.py | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/tools/kconfig_new/confgen.py b/tools/kconfig_new/confgen.py index fd1f6a0df0..77feae5b33 100755 --- a/tools/kconfig_new/confgen.py +++ b/tools/kconfig_new/confgen.py @@ -115,7 +115,16 @@ class DeprecatedOptions(object): def append_doc(self, config, visibility, path_output): def option_was_written(opt): - return any(visibility.visible(node) for node in config.syms[opt].nodes) + # named choices were written if any of the symbols in the choice were visible + if new_opt in config.named_choices: + syms = config.named_choices[new_opt].syms + for s in syms: + if any(visibility.visible(node) for node in s.nodes): + return True + return False + else: + # otherwise if any of the nodes associated with the option was visible + return any(visibility.visible(node) for node in config.syms[opt].nodes) if len(self.r_dic) > 0: with open(path_output, 'a') as f_o: @@ -123,7 +132,7 @@ class DeprecatedOptions(object): f_o.write('.. _configuration-deprecated-options:\n\n{}\n{}\n\n'.format(header, '-' * len(header))) for dep_opt in sorted(self.r_dic): new_opt = self.r_dic[dep_opt] - if new_opt not in config.syms or (config.syms[new_opt].choice is None and option_was_written(new_opt)): + if option_was_written(new_opt) and (new_opt not in config.syms or config.syms[new_opt].choice is None): # everything except config for a choice (no link reference for those in the docs) f_o.write('- {}{} (:ref:`{}{}`)\n'.format(config.config_prefix, dep_opt, config.config_prefix, new_opt))