a
    [fi                     @   sZ   d dl Z d dlZd dlZd dlZd dlZd dlZd dlZejdd Zdd Z	dd Z
dS )    Nc               	   c   s.   t  } z| V  W t|  nt|  0 dS )z2Create a temporary directory in a context manager.N)tempfilemkdtempshutilrmtree)td r   mC:\Users\91910\OneDrive\Desktop\vts_admin_rebuild-master\vts\Lib\site-packages\pip/_vendor/pep517/dirtools.pytempdir
   s    r	   c               
   O   sJ   zt j| i |W S  tyD } z|jtjkr0 W Y d}~n
d}~0 0 dS )zWLike `mkdir`, but does not raise an exception if the
    directory already exists.
    N)osmkdirOSErrorerrnoEEXIST)argskwargsexcr   r   r   mkdir_p   s
    r   c                 C   s   t  }t|d}t| D ]r\} }}|D ]0}tj| |}tj|| }|	|d d q,|D ],}tj| |}tj|| }|
|| qbq|S )z0Construct an in-memory zip file for a directory.w/ )ioBytesIOzipfileZipFiler
   walkpathjoinrelpathwritestrwrite)rootbufferzip_filedirsfilesr   Zfs_pathrel_pathr   r   r   dir_to_zipfile   s    r&   )r
   r   
contextlibr   r   r   r   contextmanagerr	   r   r&   r   r   r   r   <module>   s   
	