B š•Reiã@sZddlZddlZddlZddlZddlZddlZddlZejdd„ƒZdd„Z dd„Z dS)éNc cs$t ¡}z |VWdt |¡XdS)z2Create a temporary directory in a context manager.N)ÚtempfileÚmkdtempÚshutilÚrmtree)Útd©rúŠ/builddir/build/BUILDROOT/alt-python37-pip-20.2.4-6.el8.x86_64/opt/alt/python37/lib/python3.7/site-packages/pip/_vendor/pep517/dirtools.pyÚtempdir s r c OsBy tj||ŽStk r<}z|jtjkr,‚Wdd}~XYnXdS)zWLike `mkdir`, but does not raise an exception if the directory already exists. N)ÚosÚmkdirÚOSErrorÚerrnoÚEEXIST)ÚargsÚkwargsÚexcrrrÚmkdir_ps   rcCs¢t ¡}t |d¡}xˆt |¡D]z\}}}x8|D]0}tj ||¡}tj ||¡}|  |dd¡q0Wx4|D],}tj ||¡}tj ||¡}|  ||¡qjWq W|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ÚfilesrZfs_pathÚrel_pathrrrÚdir_to_zipfiles   r&) r rÚ contextlibrrr rÚcontextmanagerr rr&rrrrÚs