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>
This commit is contained in:
1 parent
0a984afd81
commit
cd5ecdbaee
14 files changed
+46
-25
No files matched your search
@@ -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:
|
||||
|
||||
Reference in new issue
Block a user