def start(main_script): assert isinstance(main_script, String) lib_scope = ModuleScope( pathobj.concat(main.get_ec().lever_path, pathobj.parse(u"lib")), root_module) main_path = pathobj.os_parse(resuffix(main_script.string, u".lc", u"")) mi = moduleinfo(pathobj.abspath(main_path)) scope = ModuleScope(mi.directory, lib_scope) this = Module(mi.name.string, {}, extends=base.module) # base.module if not (mi.lc_present or mi.cb_present): raise OldError(u"main module not present") mi.default_config(this, scope) mi.loadit(this) scope.setcache(main_path, this, max(mi.lc_mtime, mi.cb_mtime)) return this
def get_sthread(): ec = main.get_ec() if not ec.sthread: ec.sthread = SThread(ec.config) return ec.sthread