U
    |eG                     @  s\   d dl mZ d dlmZ ddlmZ ddlmZmZmZ dd Z	dd	 Z
d
d Zd	dgZdS )    )annotations)get_embed_wheel   )periodic_update)VersionWheeldiscover_wheelsc              	   C  st   t |}t|| ||}|t jkrp|jrB|}	t| ||||||	|}t| |||}
|
dk	rp|dksl|
j|jkrp|
}|S )z,Load the bundled wheel to a cache directory.N)r   
of_versionload_embed_wheelembedZ
can_updater   from_dirZversion_tuple)distributionversionfor_py_versionZsearch_dirsapp_dataZdo_periodic_updateenvr	   wheelZperZfound_wheel r   A/tmp/pip-unpacked-wheel-tuxcr54r/virtualenv/seed/wheels/bundle.pyfrom_bundle	   s    

r   c              	     s\   t ||}|d k	rX||jk}|d ks(|rT |j fdd}t|}W 5 Q R X nd }|S )Nc                     s    j S )N)Zhouser   r   r   r   <lambda>        z"load_embed_wheel.<locals>.<lambda>)r   r   Zensure_extractedpathr   )r   r   r   r   r   Zversion_match
wheel_pathr   r   r   r
      s    

r
   c                 C  s,   |D ]"}t || ||D ]}|    S qdS )z,Load a compatible wheel from a given folder.N)r   )r   r   r   directoriesfolderr   r   r   r   r   '   s    r   N)
__future__r   Zvirtualenv.seed.wheels.embedr   r   utilr   r   r   r   r
   r   __all__r   r   r   r   <module>   s   	