""" A PEP 302 meta path importer for finding optionally-vendored or otherwise naturally-installed packages from root_name. """
def search_path(self): """ Search first the vendor package then as a natural package. """ yield ''
""" Return self when fullname starts with root_name and the target module is one vendored through this importer. """ return
""" Iterate over the search path to locate and load fullname. """ # mysterious hack: # Remove the reference to the extant package/module # on later Python versions to cause relative imports # in the vendor package to resolve the same modules # as those going through this importer. except ImportError: pass else: raise ImportError( "The '{target}' package is required; " "normally this is bundled with this package so if you get " "this warning, consult the packager of your " "distribution.".format(**locals()) )
""" Install this importer into sys.meta_path if not already present. """
|