On 05/20/2014 02:53 PM, Yu Xin Huo wrote:
Sample plugin has no difference from other plugins, it is wrong to specially design a command for that sample plugin.
A plugin should have a way to disable itself, I prefer the original way to disable a plugin like below.

In plugin descriptor xml file, comment out all tabs, if no tabs is defined, then the plugin will not be loaded.
By this way, no special command is needed, no additional overhead in coding is needed.
Does that mean the user needs to find this file and uncomment these codes when he want to try the plugin.

Usually, a user wants to add a new plugin, he can reference the sample plugin codes.
He can try it first to how it works and then read the code to how he can make himself plugin.

we can change "--enbale-plugins" to "--enable-sample".
our switch command("--enable-sample") is also an example, ti tells user how he build a plugin with kimchi
together if he just add one plugin.

Also he can add "with"  command for his plugins if he wants to add more than one plugin.
such as:
The  "with"  command is similar to switch command, a plugin developer can read the autotool document to
learn more about it.

On 5/19/2014 5:31 PM, Yu Xin Huo wrote:
On 5/17/2014 3:30 AM, shaohef@linux.vnet.ibm.com wrote:
From: ShaoHe Feng <shaohef@linux.vnet.ibm.com>

sample plugin is used to test as a plugin demo.

we disable it by default.

use this command to enable sample plugin
$ ./autogen.sh --enable-plugins
As this command is specially used to enable the sample plugin, so the param of "enable-plugins" is quite confusing, looks like enabling all the plugins.
If it is only to enable that sample plugin, I do not think it is worth to add such a command specially for that.

Signed-off-by: ShaoHe Feng <shaohef@linux.vnet.ibm.com>
  configure.ac                                   | 10 ++++++++++
  plugins/sample/Makefile.am                     | 18 +++++++++++++++++-
  plugins/sample/{sample.conf => sample.conf.in} |  2 +-
  3 files changed, 28 insertions(+), 2 deletions(-)
  rename plugins/sample/{sample.conf => sample.conf.in} (90%)

diff --git a/configure.ac b/configure.ac
index cc971e8..ab1b302 100644
--- a/configure.ac
+++ b/configure.ac
@@ -48,6 +48,16 @@ if test "x$PYFLAKES" = "x"; then
    AC_MSG_WARN([pyflakes not found])

+    [plugins],
+        [--enable-plugins],
+        [build plugins packages @<:@default=no@:>@]
+    )],
+    ,
+    [enable_plugins="no"]
+AM_CONDITIONAL([PLUGINS], [test "${enable_plugins}" = "yes"])

diff --git a/plugins/sample/Makefile.am b/plugins/sample/Makefile.am
index e03a4c0..b0beb32 100644
--- a/plugins/sample/Makefile.am
+++ b/plugins/sample/Makefile.am
@@ -19,4 +19,20 @@

  SUBDIRS = ui

-EXTRA_DIST = API.json sample.conf $(wildcard *.py)
+EXTRA_DIST = API.json sample.conf.in $(wildcard *.py)
+do_substitution = \
+    sed -e 's,[@]ENABLE_PLUGINS[@],$(ENABLE_PLUGINS),g'
+sample.conf: sample.conf.in Makefile
+    echo $(ENABLE_PLUGINS)
+    $(do_substitution) < $< > $@
+BUILT_SOURCES = sample.conf
+CLEANFILES = sample.conf
diff --git a/plugins/sample/sample.conf b/plugins/sample/sample.conf.in
similarity index 90%
rename from plugins/sample/sample.conf
rename to plugins/sample/sample.conf.in
index 78a9f4e..12a3eef 100644
--- a/plugins/sample/sample.conf
+++ b/plugins/sample/sample.conf.in
@@ -1,5 +1,5 @@
-enable = True
+enable = @ENABLE_PLUGINS@
  plugin_class = "Drawings"
  uri = "/plugins/sample"

Kimchi-devel mailing list

Kimchi-devel mailing list

Thanks and best regards!

Sheldon Feng(冯少合)<shaohef@linux.vnet.ibm.com>
IBM Linux Technology Center