o
    
a:	                     @   s4   d dl Zd dlZG dd dZdZeee  dS )    Nc                   @   sX   e Zd ZdZdddZedd Zdd	 Zd
d Zdd Z	dd Z
d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 )NZexternZ_vendor)	root_namesetvendored_namesreplace
vendor_pkg)selfr   r   r   r   r   k/home/rieder/labs.polsys.net/tools/diffstream/lib/python3.10/site-packages/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   s.   | | jd \}}}| ott|j| jS )z,Figure out if the target module is vendored.r   )	partitionr   anymap
startswithr   )r	   fullnamerootbasetargetr   r   r
   _module_matches_namespace   s   z(VendorImporter._module_matches_namespacec              	   C   sx   | | jd \}}}| jD ]"}z|| }t| tj| }|tj|< |W   S  ty0   Y qw tdjdi t )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.Nr   )	r   r   r   
__import__sysmodulesImportErrorformatlocals)r	   r   r   r   r   prefixZextantmodr   r   r
   load_module   s$   



zVendorImporter.load_modulec                 C   s   |  |jS N)r!   name)r	   specr   r   r
   create_module3   s   zVendorImporter.create_modulec                 C   s   d S r"   r   )r	   moduler   r   r
   exec_module6   s   zVendorImporter.exec_modulec                 C   s   |  |rtj|| S dS )z(Return a module spec for vendored names.N)r   	importlibutilspec_from_loader)r	   r   pathr   r   r   r
   	find_spec9   s
   zVendorImporter.find_specc                 C   s   | t jvrt j|  dS 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)NN)__name__
__module____qualname____doc__r   propertyr   r   r!   r%   r'   r,   r/   r   r   r   r
   r      s    


r   )	packagingZ	pyparsingappdirs)importlib.utilr(   r   r   namesr0   r/   r   r   r   r
   <module>   s
    C