a
ˆlji ã @ sZ d dl Z d dlZd dlZd dlZd dlZd dlZd dlZejdd„ ƒZdd„ Z dd„ Z
dS )é Nc c s. t ¡ } z| V W t | ¡ nt | ¡ 0 dS )z2Create a temporary directory in a context manager.N)ÚtempfileZmkdtempÚshutilÚrmtree)Ztd© r ú?/usr/lib/python3.9/site-packages/pip/_vendor/pep517/dirtools.pyÚtempdir
s r c
O sJ zt j| i |¤ŽW S tyD } z|jtjkr0‚ W Y d}~n
d}~0 0 dS )zWLike `mkdir`, but does not raise an exception if the
directory already exists.
N)ÚosÚmkdirÚOSErrorÚerrnoZEEXIST)ÚargsÚkwargsÚexcr r r Úmkdir_p s
r c C s– t ¡ }t |d¡}t | ¡D ]r\} }}|D ]0}tj | |¡}tj || ¡}| |d d¡ q,|D ],}tj | |¡}tj || ¡}|
||¡ qbq|S )z0Construct an in-memory zip file for a directory.Úwú/Ú )ÚioÚBytesIOÚzipfileÚZipFiler ÚwalkÚpathÚjoinÚrelpathZwritestrÚwrite)ÚrootÚbufferZzip_fileÚdirsÚfilesr Zfs_pathZrel_pathr r r Údir_to_zipfile s r )r r Ú
contextlibr r r r Úcontextmanagerr r r r r r r Ú