
    
_d	                     Z    d dl Zd dlZ G d d      ZdZ eee      j                          y)    Nc                   N    e Zd ZdZddZed        Zd Zd Zd Z	d Z
dd	Zd
 Zy)VendorImporterz
    A PEP 302 meta path importer for finding optionally-vendored
    or otherwise naturally-installed packages from root_name.
    Nc                 h    || _         t        |      | _        |xs |j                  dd      | _        y )Nextern_vendor)	root_namesetvendored_namesreplace
vendor_pkg)selfr   r
   r   s       ?/usr/lib/python3/dist-packages/pkg_resources/extern/__init__.py__init__zVendorImporter.__init__   s/    "!.1$N	(9(9(I(N    c              #   6   K   | j                   dz    d yw)zL
        Search first the vendor package then as a natural package.
        . N)r   r   s    r   search_pathzVendorImporter.search_path   s     
 oo##s   c                     |j                  | j                  dz         \  }}}| xr) t        t        |j                  | j
                              S )z,Figure out if the target module is vendored.r   )	partitionr   anymap
startswithr
   )r   fullnamerootbasetargets        r   _module_matches_namespacez(VendorImporter._module_matches_namespace   sG    %//0DEdFxLCF$5$5t7J7J KLLr   c                 @   |j                  | j                  dz         \  }}}| j                  D ]<  }	 ||z   }t        |       t        j
                  |   }|t        j
                  |<   |c S  t         dj                  di t                     # t        $ r Y mw xY w)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. )	r   r   r   
__import__sysmodulesImportErrorformatlocals)r   r   r   r   r   prefixextantmods           r   load_modulezVendorImporter.load_module   s     &//0DEdF&& 	F&6"kk&)(+H%
	 '   !'3 *03   s   7B	BBc                 8    | j                  |j                        S N)r+   name)r   specs     r   create_modulezVendorImporter.create_module3   s    		**r   c                      y r-   r!   )r   modules     r   exec_modulezVendorImporter.exec_module6   s    r   c                 h    | j                  |      r t        j                  j                  ||       S dS )z(Return a module spec for vendored names.N)r   	importlibutilspec_from_loader)r   r   pathr   s       r   	find_speczVendorImporter.find_spec9   s7     --h7 NN++Hd;	
 	
r   c                 h    | t         j                  vr t         j                  j                  |        yy)zR
        Install this importer into sys.meta_path if not already present.
        N)r#   	meta_pathappendr   s    r   installzVendorImporter.installA   s'     s}}$MM  & %r   )r!   N)NN)__name__
__module____qualname____doc__r   propertyr   r   r+   r0   r3   r9   r=   r!   r   r   r   r      s@    
O
  M
,+
'r   r   )	packagingplatformdirsjaracoimportlib_resourcesmore_itertools)importlib.utilr5   r#   r   namesr>   r=   r!   r   r   <module>rJ      s4     
A' A'H	 x  ' ' )r   