ReijddlZddlZddlZddlZddlZddlZddlZejdZdZ dZ dS)Nc#Ktj} |Vtj|dS#tj|wxYw)z2Create a temporary directory in a context manager.N)tempfilemkdtempshutilrmtree)tds /builddir/build/BUILDROOT/alt-python311-pip-21.3.1-3.el8.x86_64/opt/alt/python311/lib/python3.11/site-packages/pip/_vendor/pep517/dirtools.pytempdirr sP    B b bs 1Ac tj|i|S#t$r!}|jtjkrYd}~dSd}~wwxYw)zWLike `mkdir`, but does not raise an exception if the directory already exists. N)osmkdirOSErrorerrnoEEXIST)argskwargsexcs r mkdir_prsax((((  9 $ $  % $ $ $ $ $s >9>ctj}tj|d}t j|D]\}}}|D][}tj||}tj||}| |dzd\|D]X}tj||}tj||}| ||Y|S)z0Construct an in-memory zip file for a directory.w/) ioBytesIOzipfileZipFiler walkpathjoinrelpathwritestrwrite)rootbufferzip_filedirsfilesrfs_pathrel_paths r dir_to_zipfiler*s Z\\Fvs++HWT]]..dE 2 2Dgll4..Gww55H   hnb 1 1 1 1 . .Dgll4..Gww55H NN7H - - - - . O) r r contextlibrrrrcontextmanagerr rr*r+r r/s        r+