From 4560577fce7e64fdd393d9e54dac237f35e8a25f Mon Sep 17 00:00:00 2001 From: Lars Wirzenius Date: Wed, 22 Feb 2012 17:23:04 +0000 Subject: Add a plugin system This code was originally written separately, which is why there's no history of it in the cliapp version control repository. The code is derived from code I wrote for obnam. --- test-plugins/aaa_hello_plugin.py | 8 ++++++++ test-plugins/hello_plugin.py | 15 +++++++++++++++ test-plugins/oldhello_plugin.py | 9 +++++++++ test-plugins/wrongversion_plugin.py | 12 ++++++++++++ 4 files changed, 44 insertions(+) create mode 100644 test-plugins/aaa_hello_plugin.py create mode 100644 test-plugins/hello_plugin.py create mode 100644 test-plugins/oldhello_plugin.py create mode 100644 test-plugins/wrongversion_plugin.py (limited to 'test-plugins') diff --git a/test-plugins/aaa_hello_plugin.py b/test-plugins/aaa_hello_plugin.py new file mode 100644 index 0000000..b8f3253 --- /dev/null +++ b/test-plugins/aaa_hello_plugin.py @@ -0,0 +1,8 @@ +import cliapp + +class Hello(cliapp.Plugin): + + def __init__(self, foo, bar=None): + self.foo = foo + self.bar = bar + diff --git a/test-plugins/hello_plugin.py b/test-plugins/hello_plugin.py new file mode 100644 index 0000000..1a4f1ea --- /dev/null +++ b/test-plugins/hello_plugin.py @@ -0,0 +1,15 @@ +import cliapp + +class Hello(cliapp.Plugin): + + def __init__(self, foo, bar=None): + self.foo = foo + self.bar = bar + + @property + def version(self): + return '0.0.1' + + def setup(self): + self.setup_called = True + diff --git a/test-plugins/oldhello_plugin.py b/test-plugins/oldhello_plugin.py new file mode 100644 index 0000000..e401ff7 --- /dev/null +++ b/test-plugins/oldhello_plugin.py @@ -0,0 +1,9 @@ +import cliapp + +class Hello(cliapp.Plugin): + + def __init__(self, foo, bar=None): + self.foo = foo + self.bar = bar + + diff --git a/test-plugins/wrongversion_plugin.py b/test-plugins/wrongversion_plugin.py new file mode 100644 index 0000000..9f54908 --- /dev/null +++ b/test-plugins/wrongversion_plugin.py @@ -0,0 +1,12 @@ +# This is a test plugin that requires a newer application version than +# what the test harness specifies. + +import cliapp + +class WrongVersion(cliapp.Plugin): + + required_application_version = '9999.9.9' + + def __init__(self, *args, **kwargs): + pass + -- cgit v1.2.1