diff options
author | Bogdano Arendartchuk <bogdano@mandriva.org> | 2007-05-02 17:39:28 +0000 |
---|---|---|
committer | Bogdano Arendartchuk <bogdano@mandriva.org> | 2007-05-02 17:39:28 +0000 |
commit | 0b5ebe2e1b3becfd57c15dc3d585ffcd22b47076 (patch) | |
tree | 7e434f732783b2398fdb44d01a1a61a9df5ca3d9 /RepSys/plugins/__init__.py | |
parent | 91700a68924f4b2e97a18f2c3787bd885c36640c (diff) | |
download | mgarepo-0b5ebe2e1b3becfd57c15dc3d585ffcd22b47076.tar mgarepo-0b5ebe2e1b3becfd57c15dc3d585ffcd22b47076.tar.gz mgarepo-0b5ebe2e1b3becfd57c15dc3d585ffcd22b47076.tar.bz2 mgarepo-0b5ebe2e1b3becfd57c15dc3d585ffcd22b47076.tar.xz mgarepo-0b5ebe2e1b3becfd57c15dc3d585ffcd22b47076.zip |
Merged work on plugins support, including the possibility to wrap
configuration sections.
Diffstat (limited to 'RepSys/plugins/__init__.py')
-rw-r--r-- | RepSys/plugins/__init__.py | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/RepSys/plugins/__init__.py b/RepSys/plugins/__init__.py new file mode 100644 index 0000000..8bf4521 --- /dev/null +++ b/RepSys/plugins/__init__.py @@ -0,0 +1,27 @@ +import os + +loaded = {} + +def load(): + # based on smart's plugin system + pluginsdir = os.path.dirname(__file__) + for entry in os.listdir(pluginsdir): + if entry != "__init__.py" and entry.endswith(".py"): + name = entry[:-3] + loaded[name] = __import__("RepSys.plugins."+name, + fromlist=[name]) + elif os.path.isdir(entry): + initfile = os.path.join(entry, "__init__.py") + if os.path.isfile(initfile): + loaded[entry] = __import__("RepSys.plugins."+entry, + fromlist=[entry]) + +def list(): + return loaded.keys() + +def help(name): + from RepSys import Error + try: + return loaded[name].__doc__ + except KeyError: + raise Error, "plugin %s not found" % name |