private PyModuleSpec findInAssemblies(string name, List <Assembly> assemblies, ClrContext loaderContext) { // TODO: Try to find a faster way to do these lookups. foreach (var assembly in assemblies) { foreach (var type in assembly.GetTypes()) { if (type.Namespace == name) { var spec = PyModuleSpec.Create(name, loader, "", null); spec.LoaderState = loaderContext; return(spec); } } // Still here? Maybe it's an actual type, not an assembly! foreach (var type in assembly.GetTypes()) { if (type.Name == name) { var spec = PyModuleSpec.Create(name, loader, "", null); spec.LoaderState = loaderContext; return(spec); } } } return(null); }
public PyModuleSpec find_spec(FrameContext context, string name, string import_path, PyModule target) { var module = findModule(name); if (module == null) { return(null); } else { var spec = PyModuleSpec.Create(name, loader, "", null); spec.LoaderState = module; return(spec); } }
public PyModuleSpec find_spec(FrameContext context, string name, string import_path, PyModule target) { var splitNames = name.Split('.'); foreach (var moduleRoot in moduleRootPaths) { var foundPath = findModule(splitNames, moduleRoot); if (foundPath != null) { var spec = PyModuleSpec.Create(name, loader, "", null); spec.LoaderState = foundPath; return(spec); } } // Fall-through: Module not found. Return null according to specifications. return(null); }