Openembedded Core Discussions
 help / color / mirror / Atom feed
From: Ed Bartosh <ed.bartosh@linux.intel.com>
To: openembedded-core@lists.openembedded.org
Subject: [wic][PATCH] wic: Integrated plugin docstrings into 'wic help plugins' output
Date: Wed, 17 Jun 2015 09:56:44 +0300	[thread overview]
Message-ID: <1434524204-13115-1-git-send-email-ed.bartosh@linux.intel.com> (raw)

Added mechanism to show docstrings of plugin classes as a part of
plugins help page.
For missing plugins the following warning message is shown:
<class '<plugin class spec>'> is missing docstring.

[YOCTO #7118]

Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com>
---
 scripts/lib/image/help.py | 18 ++++++++++++++++++
 scripts/wic               |  2 +-
 2 files changed, 19 insertions(+), 1 deletion(-)

diff --git a/scripts/lib/image/help.py b/scripts/lib/image/help.py
index a546c7c..9321149 100644
--- a/scripts/lib/image/help.py
+++ b/scripts/lib/image/help.py
@@ -28,6 +28,7 @@
 import subprocess
 import logging
 
+from wic.plugin import pluginmgr, PLUGIN_TYPES
 
 def subcommand_error(args):
     logging.info("invalid subcommand %s" % args[0])
@@ -55,6 +56,23 @@ def wic_help(args, usage_str, subcommands):
         print(usage_str)
 
 
+def get_wic_plugins_help():
+    """
+    Combine wic_plugins_help with the help for every known
+    source plugin.
+    """
+    result = wic_plugins_help
+    for plugin_type in PLUGIN_TYPES:
+        result += '\n\n%s PLUGINS\n\n' % plugin_type.upper()
+        for name, plugin in pluginmgr.get_plugins(plugin_type).iteritems():
+            result += "\n %s plugin:\n" % name
+            if plugin.__doc__:
+                result += plugin.__doc__
+            else:
+                result += "\n    %s is missing docstring\n" % plugin
+    return result
+
+
 def invoke_subcommand(args, parser, main_command_usage, subcommands):
     """
     Dispatch to subcommand handler borrowed from combo-layer.
diff --git a/scripts/wic b/scripts/wic
index d48e45d..a38ecc0 100755
--- a/scripts/wic
+++ b/scripts/wic
@@ -277,7 +277,7 @@ subcommands = {
                   hlp.wic_list_help],
     "plugins":   [wic_help_topic_subcommand,
                   wic_help_topic_usage,
-                  hlp.wic_plugins_help],
+                  hlp.get_wic_plugins_help()],
     "overview":  [wic_help_topic_subcommand,
                   wic_help_topic_usage,
                   hlp.wic_overview_help],
-- 
2.1.4



                 reply	other threads:[~2015-06-17  8:50 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1434524204-13115-1-git-send-email-ed.bartosh@linux.intel.com \
    --to=ed.bartosh@linux.intel.com \
    --cc=openembedded-core@lists.openembedded.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox