
}_	                 @   s<   d  d l  Z  Gd d   d  Z d Z e e e  j   d S)	    Nc               @   sa   e  Z d  Z d Z f  d d d  Z e d d    Z d d d  Z d	 d
   Z d d   Z	 d S)VendorImporterz
    A PEP 302 meta path importer for finding optionally-vendored
    or otherwise naturally-installed packages from root_name.
    Nc             C   s7   | |  _  t |  |  _ | p- | j d d  |  _ d  S)Nextern_vendor)	root_namesetvendored_namesreplace
vendor_pkg)selfr   r   r	    r   F/tmp/pip-build-3_sjtvrs/pkg-resources/pkg_resources/extern/__init__.py__init__
   s    	zVendorImporter.__init__c             c   s   |  j  d Vd Vd S)zL
        Search first the vendor package then as a natural package.
        . N)r	   )r
   r   r   r   search_path   s    zVendorImporter.search_pathc             C   sL   | j  |  j d  \ } } } | r) d St t | j |  j   sH d S|  S)z
        Return self when fullname starts with root_name and the
        target module is one vendored through this importer.
        r   N)	partitionr   anymap
startswithr   )r
   fullnamepathrootbasetargetr   r   r   find_module   s    zVendorImporter.find_modulec             C   s   | j  |  j d  \ } } } x |  j D]j } yO | | } t |  t j | } | t j | <t j d k ry t j | =| SWq) t k
 r Yq) Xq) Wt d j t	       d S)zK
        Iterate over the search path to locate and load fullname.
        r      zThe '{target}' package is required; normally this is bundled with this package so if you get this warning, consult the packager of your distribution.N)r   r   )
r   r   r   
__import__sysmodulesversion_infoImportErrorformatlocals)r
   r   r   r   r   prefixextantmodr   r   r   load_module#   s    


	zVendorImporter.load_modulec             C   s#   |  t  j k r t  j j |   d S)zR
        Install this importer into sys.meta_path if not already present.
        N)r   	meta_pathappend)r
   r   r   r   install@   s    zVendorImporter.install)
__name__
__module____qualname____doc__r   propertyr   r   r&   r)   r   r   r   r   r      s   r   	packaging	pyparsingsixappdirs)r/   r0   r1   r2   )r   r   namesr*   r)   r   r   r   r   <module>   s   D