source: soft/build_system/build_system/repsys/branches/V1_6_X/RepSys/plugins/__init__.py @ 1

Last change on this file since 1 was 1, checked in by fasma, 12 years ago

Initial Import from Mandriva's soft revision 224062 and package revision 45733

File size: 790 bytes
Line 
1import os
2
3loaded = {}
4
5def load():
6    # based on smart's plugin system
7    pluginsdir = os.path.dirname(__file__)
8    for entry in os.listdir(pluginsdir):
9        if entry != "__init__.py" and entry.endswith(".py"):
10            name = entry[:-3]
11            loaded[name] = __import__("RepSys.plugins."+name, {}, {},
12                    [name])
13        elif os.path.isdir(entry):
14            initfile = os.path.join(entry, "__init__.py")
15            if os.path.isfile(initfile):
16                loaded[entry] = __import__("RepSys.plugins."+entry, {}, {},
17                        [entry])
18
19def list():
20    return loaded.keys()
21
22def help(name):
23    from RepSys import Error
24    try:
25        return loaded[name].__doc__
26    except KeyError:
27        raise Error, "plugin %s not found" % name
Note: See TracBrowser for help on using the repository browser.