Added plugin example
authorEd Bartosh <eduard.bartosh@intel.com>
Sat, 10 Aug 2013 18:25:25 +0000 (21:25 +0300)
committerEduard Bartosh <eduard.bartosh@intel.com>
Tue, 13 Aug 2013 06:55:27 +0000 (23:55 -0700)
Example shows how to implement 3rd party repa plugins

Change-Id: I0bfc523a87d867e7d8564e00ef317d1ac824b9f2
Signed-off-by: Ed Bartosh <eduard.bartosh@intel.com>
Reviewed-on: https://otctools.jf.intel.com/review/5836
Tested-by: OTC Tools Tester <ed.bartosh@linux.intel.com>
examples/plugin/repa_plugin/__init__.py [new file with mode: 0644]
examples/plugin/repa_plugin/plugin.py [new file with mode: 0644]
examples/plugin/setup.py [new file with mode: 0644]

diff --git a/examples/plugin/repa_plugin/__init__.py b/examples/plugin/repa_plugin/__init__.py
new file mode 100644 (file)
index 0000000..b8f4d9c
--- /dev/null
@@ -0,0 +1,11 @@
+"""
+REPA: Release Engineering Process Assistant.
+
+Copyright (C) Intel Corporation 2013
+Licence: GPL version 2
+Author: Ed Bartosh <eduard.bartosh@intel.com>
+
+Repa subcommand plugin.
+Init.
+"""
+
diff --git a/examples/plugin/repa_plugin/plugin.py b/examples/plugin/repa_plugin/plugin.py
new file mode 100644 (file)
index 0000000..d1d02f3
--- /dev/null
@@ -0,0 +1,37 @@
+#!/usr/bin/env python
+
+"""
+REPA: Release Engineering Process Assistant.
+
+Copyright (C) Intel Corporation 2013
+Licence: GPL version 2
+Author: Ed Bartosh <eduard.bartosh@intel.com>
+
+Test repa command plugin.
+After installation new command 'test' will be added to repa
+"""
+
+import sys
+
+from repa.main import sub_main
+
+class Test(object):
+    """Subcommand: test."""
+
+    name = 'test'
+    description = 'Test repa command plugin'
+    help = description
+
+    @staticmethod
+    def add_arguments(parser):
+        """Adds arguments to the parser. Called from [sub_]main."""
+        parser.add_argument('--opt', help='test option')
+
+    def run(self, argv):
+        """Command line entry point."""
+        print '%s: Not implemented yet' % self.help
+        print 'paremeter: %s' % argv.opt
+
+
+if __name__ == '__main__':
+    sys.exit(sub_main(sys.argv[1:], Test()))
diff --git a/examples/plugin/setup.py b/examples/plugin/setup.py
new file mode 100644 (file)
index 0000000..3b1ff37
--- /dev/null
@@ -0,0 +1,23 @@
+#!/usr/bin/env python
+
+"""
+REPA: Release Engineering Process Assistant.
+
+Copyright (C) Intel Corporation 2013
+Licence: GPL version 2
+Author: Ed Bartosh <eduard.bartosh@intel.com>
+
+Setup module for example repa plugin
+"""
+
+from setuptools import setup
+
+setup(name = "repa_plugin",
+      version = '0.0.1',
+      author = 'Ed Bartosh',
+      author_email = 'eduard.bartosh@intel.com',
+      packages = ['repa_plugin'],
+      entry_points = {
+         'repa_commands':   ['repa_plugin = repa_plugin.plugin:Test']
+      }
+)