o
    Ëý°ji  ã                   @   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 | ¡ dS t | ¡ w )z2Create a temporary directory in a context manager.N)ÚtempfileÚmkdtempÚshutilÚrmtree)Útd© r   úŽ/root/aizidognhua/tmp/workspace/projects/ec89d86c-575f-41c9-af57-ac45cbdbf775/venv/lib/python3.10/site-packages/pip/_vendor/pep517/dirtools.pyÚtempdir
   s
   €r	   c               
   O   sH   z	t j| i |¤ŽW S  ty# } z|jtjkr‚ W Y d}~dS d}~ww )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 ]9\} }}|D ]}tj | |¡}tj || ¡}| 	|d d¡ q|D ]}tj | |¡}tj || ¡}| 
||¡ q1q|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   Ú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    
	