3 ] @s.ddlZGdddZdZeeedjdS) Nc@sDeZdZdZfdfddZeddZd ddZd d Zd d Z dS)VendorImporterz A PEP 302 meta path importer for finding optionally-vendored or otherwise naturally-installed packages from root_name. NcCs&||_t||_|p|jdd|_dS)Nextern_vendor) root_namesetvendored_namesreplace vendor_pkg)selfrrr r @/tmp/pip-build-8jg9gmni/setuptools/setuptools/extern/__init__.py__init__ s zVendorImporter.__init__ccs|jdVdVdS)zL Search first the vendor package then as a natural package. .N)r )r r r r search_paths zVendorImporter.search_pathcCs8|j|jd\}}}|rdStt|j|js4dS|S)z Return self when fullname starts with root_name and the target module is one vendored through this importer. rN) partitionranymap startswithr)r fullnamepathrootbasetargetr r r find_modules zVendorImporter.find_modulec Cs|j|jd\}}}xp|jD]T}y:||}t|tj|}|tj|<tjdkrZtj|=|Stk rpYqXqWtdjft dS)zK Iterate over the search path to locate and load fullname. rzThe '{target}' package is required; normally this is bundled with this package so if you get this warning, consult the packager of your distribution.N)rr) rrr __import__sysmodules version_info ImportErrorformatlocals)r rrrrprefixextantmodr r r load_module#s     zVendorImporter.load_modulecCs|tjkrtjj|dS)zR Install this importer into sys.meta_path if not already present. N)r meta_pathappend)r r r r install@s zVendorImporter.install)N) __name__ __module__ __qualname____doc__r propertyrrr&r)r r r r rs   rsix packaging pyparsingzsetuptools._vendor)r/r0r1)rrnamesr*r)r r r r sD