U
    ?v¨gÒ	  ã                   @   s.   d dl Z G dd„ dƒZdZeeedƒ ¡  dS )é    Nc                   @   s@   e Zd ZdZ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   s&   || _ t|ƒ| _|p| dd¡| _d S )NÚexternÚ_vendor)Ú	root_nameÚsetÚvendored_namesÚreplaceÚ
vendor_pkg)Úselfr   r   r
   r   r   ú>/tmp/pip-unpacked-wheel-ybtpfviz/setuptools/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   s8   |  | jd ¡\}}}|rdS tt|j| jƒƒs4d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d ¡\}}}| jD ]Z}z@|| }t|ƒ tj| }|tj|< tjdkrXtj|= |W   S  tk
rt   Y qX qtdjf t	ƒ Žƒ‚dS )zK
        Iterate over the search path to locate and load fullname.
        r   )é   z•The '{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   Ú
__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 | ¡ dS )zR
        Install this importer into sys.meta_path if not already present.
        N)r   Ú	meta_pathÚappendr   r   r   r   Úinstall@   s    
zVendorImporter.install)r   N)N)
Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   Úpropertyr   r   r'   r*   r   r   r   r   r      s   


r   )ÚsixÚ	packagingÚ	pyparsingZordered_setzsetuptools._vendor)r   r   Únamesr+   r*   r   r   r   r   Ú<module>   s   D