1
2
3
4
5
6
7
8 """ real simple plugin system
9 meant as a replacement when setuptools/pkg_resources
10 are not available
11 """
12
13 import os
14 import sys
15
17 """ a new style class that
18 betrays all its sub-classes
19 """
20 pass
21
23
24 """ singleton class which holds information
25 about known plugins
26
27 currently a singleton, and even a class,
28 seems to be overkill for this, but maybe
29 we'll add some more functionality later
30 """
31
32 _instance_ = None
33
35 """ creates the singleton """
36 obj = getattr(cls,'_instance_',None)
37 if obj is not None:
38 return obj
39 else:
40 obj = super(Reception, cls).__new__(cls, *args, **kwargs)
41 cls._instance_ = obj
42 return obj
43
44 - def __init__(self,plugin_path=None,log=None):
45 """ initializes the class and
46 checks in if a path is provided
47 """
48 self.log = log
49 if plugin_path is not None:
50 self.checkin(plugin_path)
51
66
67
69 """ returns a list of all Plugin subclasses """
70 return plugin_class.__subclasses__()
71