123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566 |
- #-*- coding: utf-8 -*-
-
- import sys, os, os.path
- #
- # Bootstraping
- #
- LODEL2_LIB_ABS_PATH = None
- if LODEL2_LIB_ABS_PATH is not None:
- sys.path.append(os.path.dirname(LODEL2_LIB_ABS_PATH))
-
- try:
- import lodel
- except ImportError:
- print("Unable to load lodel module. exiting...")
- exit(1)
-
- #
- # Loading settings
- #
- from lodel.settings.settings import Settings as settings
- if not settings.started():
- settings('conf.d')
- from lodel.settings import Settings
-
- #Starts hooks
- from lodel.plugin import LodelHook
- from lodel.plugin import core_hooks
-
- def start():
- #Load plugins
- from lodel import logger
- from lodel.plugin import Plugin
- logger.debug("Loader.start() called")
- Plugin.load_all()
- LodelHook.call_hook('lodel2_bootstraped', '__main__', None)
-
-
- if __name__ == '__main__':
-
- start()
- if Settings.runtest:
- import unittest
- import tests
- loader = unittest.TestLoader()
- test_dir = os.path.join(LODEL2_LIB_ABS_PATH, 'tests')
- suite = loader.discover(test_dir)
- print("DEBUG : failfast = ", '-f' in sys.argv, sys.argv)
- runner = unittest.TextTestRunner(
- failfast = '-f' in sys.argv,
- verbosity = 2 if '-v' in sys.argv else 1)
- runner.run(suite)
- exit()
-
- import lodel
- import leapi_dyncode as dyncode
- lodel.dyncode = dyncode
- LodelHook.call_hook('lodel2_dyncode_bootstraped', '__main__', None)
- LodelHook.call_hook('lodel2_loader_main', '__main__', None)
-
- #Run interative python
- import code
- print("""
- Running interactive python in Lodel2 %s instance environment
-
- """%Settings.sitename)
- code.interact(local=locals())
|