summaryrefslogtreecommitdiffstats
path: root/makeapi
diff options
context:
space:
mode:
authorJan Cholasta <jcholast@redhat.com>2016-05-16 14:15:19 +0200
committerJan Cholasta <jcholast@redhat.com>2016-06-03 09:00:34 +0200
commitfe18adb25839bf191aa748f13e75bfccb10f4a57 (patch)
treeb0cacfe9e54e8d15219a1b1925026c2ed037772a /makeapi
parentcd5ecdbaeef153523afdeff77f07945944118115 (diff)
downloadfreeipa-fe18adb25839bf191aa748f13e75bfccb10f4a57.tar.gz
freeipa-fe18adb25839bf191aa748f13e75bfccb10f4a57.tar.xz
freeipa-fe18adb25839bf191aa748f13e75bfccb10f4a57.zip
help, makeapi: do not use hardcoded plugin package name
Iterate over all plugin packages defined in the API to find the given topic module. The last module found has priority. This will allow topics to be defined in client-side plugins. https://fedorahosted.org/freeipa/ticket/4739 Reviewed-By: David Kupka <dkupka@redhat.com>
Diffstat (limited to 'makeapi')
-rwxr-xr-xmakeapi31
1 files changed, 22 insertions, 9 deletions
diff --git a/makeapi b/makeapi
index ae664eca4..476b65149 100755
--- a/makeapi
+++ b/makeapi
@@ -171,23 +171,36 @@ def validate_doc():
while topic is not None:
if not topics.setdefault(topic, 0):
# First time seeing this module, validate the module contents
- module = 'ipalib.plugins.%s' % topic
- try:
- mod = sys.modules[module]
- except KeyError:
- mod = importlib.import_module(module)
+ doc = None
+ next_topic = None
- # See if there is a module topic, if so validate it
- next_topic = getattr(mod, 'topic', None)
+ for package in api.packages:
+ module = '%s.%s' % (package.__name__, topic)
+ try:
+ mod = sys.modules[module]
+ except KeyError:
+ try:
+ mod = importlib.import_module(module)
+ except ImportError:
+ continue
+
+ if mod.__doc__ is not None:
+ doc = mod.__doc__
+
+ # See if there is a module topic, if so validate it
+ try:
+ next_topic = mod.topic
+ except AttributeError:
+ pass
# Does the module have documentation?
- if mod.__doc__ is None:
+ if doc is None:
src_file = inspect.getsourcefile(mod)
n_missing_mod_doc += 1
print("%s: module \"%s\" has no doc" %
(src_file, module))
# Yes the module has doc, but is it internationalized?
- elif not is_i18n(mod.__doc__):
+ elif not is_i18n(doc):
src_file = inspect.getsourcefile(cmd_class)
n_missing_mod_i18n += 1
print("%s: module \"%s\" doc is not internationalized" %