confgen: Avoid including invisible (due to target) choice items in kconfig.rst renames

pull/2405/merge
Angus Gratton 2020-01-31 18:48:56 +11:00 zatwierdzone przez Angus Gratton
rodzic eb85cfb9f6
commit ac8e931179
1 zmienionych plików z 11 dodań i 2 usunięć

Wyświetl plik

@ -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))