Browse Source

loader enhancement

Yann Weber 8 years ago
parent
commit
43911cdfe4
2 changed files with 16 additions and 2 deletions
  1. 13
    2
      install/loader.py
  2. 3
    0
      plugins/dummy/__init__.py

+ 13
- 2
install/loader.py View File

@@ -11,7 +11,7 @@ if LODEL2_LIB_ABS_PATH is not None:
11 11
 try:
12 12
     import lodel
13 13
 except ImportError:
14
-    print("Unable to load lodel module. exiting...", file = sys.stderr)
14
+    print("Unable to load lodel module. exiting...")
15 15
     exit(1)
16 16
 
17 17
 
@@ -27,10 +27,21 @@ from lodel.settings import Settings
27 27
 from lodel.plugin import Plugin
28 28
 Plugin.load_all()
29 29
 
30
+
30 31
 from lodel.plugin import LodelHook
31
-LodelHook.call_hook('lodel2_bootstraped', '__main__', None)
32
+
33
+def start():
34
+    #Importing dynamic code classes in lodel.leapi
35
+    import leapi_dyncode
36
+    import lodel.leapi
37
+    for cls in leapi_dyncode.dynclasses:
38
+        setattr(lodel.leapi, cls.__name__, cls)
39
+
40
+    LodelHook.call_hook('lodel2_bootstraped', '__main__', None)
41
+
32 42
 
33 43
 if __name__ == '__main__':
44
+    start()
34 45
     LodelHook.call_hook('lodel2_loader_main', '__main__', None)
35 46
     #Run interative python
36 47
     import code

+ 3
- 0
plugins/dummy/__init__.py View File

@@ -6,5 +6,8 @@ __author__ = "Lodel2 dev team"
6 6
 __fullname__ = "Dummy plugin"
7 7
 
8 8
 
9
+##@brief This methods allow plugin writter to write some checks
10
+#
11
+#@return True if checks are OK else return a string with a reason
9 12
 def _activate():
10 13
     return True

Loading…
Cancel
Save