def find_dotted(names, parentdir=None): filename = None for name in names: mod = ImpImporter(parentdir).find_module(name) if not mod: break filename = mod.get_filename() if not filename: break parentdir = dirname(filename) else: return filename
def find_dotted(names, parentdir=None): """ Dotted import. 'names' is a list of path components, 'parentdir' is the parent directory. """ filename = None for name in names: mod = ImpImporter(parentdir).find_module(name) if not mod: break filename = mod.get_filename() if not filename: break parentdir = dirname(filename) else: return filename