diff options
author | Jan Cholasta <jcholast@redhat.com> | 2016-05-31 06:36:55 +0200 |
---|---|---|
committer | Jan Cholasta <jcholast@redhat.com> | 2016-06-03 09:00:34 +0200 |
commit | cd5ecdbaeef153523afdeff77f07945944118115 (patch) | |
tree | 9f3d2bd03cd5b918300ae36a4abcee479fa7b52d /makeapi | |
parent | 0a984afd8170b349b0745fb89168d363dfa28ffa (diff) | |
download | freeipa-cd5ecdbaeef153523afdeff77f07945944118115.tar.gz freeipa-cd5ecdbaeef153523afdeff77f07945944118115.tar.xz freeipa-cd5ecdbaeef153523afdeff77f07945944118115.zip |
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 <dkupka@redhat.com>
Diffstat (limited to 'makeapi')
-rwxr-xr-x | makeapi | 23 |
1 files changed, 11 insertions, 12 deletions
@@ -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: |