--- a/util/misc.py Fri Feb 02 11:12:03 2018 +0100
+++ b/util/misc.py Fri Feb 02 16:22:25 2018 +0100
@@ -46,21 +46,26 @@
-def GetClassImporter(classpath):
+def GetClassImporter(param): is used to resolve library class names in features.py
- returns a callable that return the class pointed by classpath string
- if a class is given instead of string, then returns a callable returning it.
+ if param is a string, returns a callable that return the class pointed by param + if a class is given, then returns a callable that returns the given class. - if isinstance(classpath, str):
+ if isinstance(param, str): # on-demand import, only when using class
- mod = __import__(classpath.rsplit('.', 1)[0])
- return reduce(getattr, classpath.split('.')[1:], mod)
+ mod = __import__(param.rsplit('.', 1)[0]) + return reduce(getattr, param.split('.')[1:], mod) + elif isinstance(param,types.ClassType):
+ # backward compatibility + # for old extensions that pass some callables + # deprecated, should not be used anymore def InstallLocalRessources(CWD):