+def load(parent, modname, dependent=False):
+ """Wrapper to call _load and print the return value."""
+ if dependent:
+ print("(Loading dependency %s..." % (modname), end=' ')
+ else:
+ print("%09.3f [MOD] [?] Loading %s..." % (time.time() % 100000, modname), end=' ')
+ modstatus = _load(parent, modname, dependent)
+ if not modstatus:
+ if dependent:
+ print("failed: %s)" % (modstatus), end=' ')
+ else:
+ print("failed: %s." % (modstatus))
+ if isinstance(modstatus, modlib.error) and isinstance(modstatus.errormsg, BaseException):
+ traceback.print_exception(modstatus.errormsg)
+ elif modstatus == True:
+ if dependent:
+ print("OK)", end=' ')
+ else:
+ print("OK.")
+ else:
+ if dependent:
+ print("OK: %s)" % (modstatus), end=' ')
+ else:
+ print("OK: %s." % (modstatus))
+ return modstatus
+
+def _load(parent, modname, dependent=False):
+ """Load and return the new status of the module."""
+ successstatus = []