def init(topology: Box) -> None: if not 'plugin' in topology: return topology.Plugin = [] for pname in topology.plugin: plugin = None for path in ('.', common.netsim_package_path, pname): if not plugin: plugin = load_plugin_from_path(path, pname) if plugin: topology.Plugin.append(plugin) else: common.error(f"Cannot find plugin {pname}", common.IncorrectValue, 'plugin')
def init(topology: Box) -> None: if not 'plugin' in topology: return topology.Plugin = [] sys.path = ["."] + sys.path for pname in topology.plugin: try: plugin = import_module(pname) except: print("Cannot load plugin %s\n%s" % (pname, str(sys.exc_info()[1]))) common.fatal('Aborting the transformation process', 'plugin') topology.Plugin.append(plugin) sys.path = sys.path[1:]
def init(topology: Box) -> None: if not 'plugin' in topology: return topology.Plugin = [] for pname in topology.plugin: plugin = None search_path = ('.', common.netsim_package_path + '/extra') for path in search_path: if not plugin: plugin = load_plugin_from_path(path, pname) if plugin: topology.Plugin.append(plugin) else: common.error(f"Cannot find plugin {pname} in {search_path}", common.IncorrectValue, 'plugin') if common.DEBUG: print(f'plug INIT: {topology.Plugin}')