From cd5ecdbaeef153523afdeff77f07945944118115 Mon Sep 17 00:00:00 2001 From: Jan Cholasta Date: Tue, 31 May 2016 06:36:55 +0200 Subject: help, makeapi: specify module topic by name Specify module topic by name rather than by name and summary. A topic module of the topic name must exist. Summary is extracted from the docstring of the topic module. This changes makes topic handling more generic and consistent between modules and commands. https://fedorahosted.org/freeipa/ticket/4739 Reviewed-By: David Kupka --- makeapi | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) (limited to 'makeapi') diff --git a/makeapi b/makeapi index 53269c508..ae664eca4 100755 --- a/makeapi +++ b/makeapi @@ -166,24 +166,19 @@ def validate_doc(): if getattr(cmd, 'NO_CLI', False): continue - if cmd.topic is not None: - # Have we processed this module yet? - if not topics.setdefault(cmd.topic, 0): + # Have we processed this module yet? + topic = cmd.topic + while topic is not None: + if not topics.setdefault(topic, 0): # First time seeing this module, validate the module contents - module = 'ipalib.plugins.%s' % cmd.topic + module = 'ipalib.plugins.%s' % topic try: mod = sys.modules[module] except KeyError: mod = importlib.import_module(module) # See if there is a module topic, if so validate it - topic = getattr(mod, 'topic', None) - if topic is not None: - if not is_i18n(topic[1]): - src_file = inspect.getsourcefile(cmd_class) - n_missing_mod_i18n += 1 - print("%s: topic in module \"%s\" is not " - "internationalized" % (src_file, module)) + next_topic = getattr(mod, 'topic', None) # Does the module have documentation? if mod.__doc__ is None: @@ -197,9 +192,13 @@ def validate_doc(): n_missing_mod_i18n += 1 print("%s: module \"%s\" doc is not internationalized" % (src_file, module)) + else: + next_topic = None # Increment the count of how many commands in this module - topics[cmd.topic] = topics[cmd.topic] + 1 + topics[topic] = topics[topic] + 1 + + topic = next_topic # Does the command have documentation? if cmd.__doc__ is None: -- cgit