a  zeiã@sZddlZddlZddlZddlZddlZddlZddlZejdd„ƒZdd„Z dd„Z dS)éNc cs.t ¡}z|VWt |¡n t |¡0dS)z2Create a temporary directory in a context manager.N)ÚtempfileÚmkdtempÚshutilÚrmtree)Útd©rú]/opt/bitninja-python-dojo/embedded/lib/python3.9/site-packages/pip/_vendor/pep517/dirtools.pyÚtempdir sr c OsJztj|i|¤ŽWStyD}z|jtjkr0‚WYd}~n d}~00dS)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¡}t |¡D]r\}}}|D]0}tj ||¡}tj ||¡}|  |dd¡q,|D],}tj ||¡}tj ||¡}|  ||¡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ÚfilesrZfs_pathÚrel_pathrrrÚdir_to_zipfiles r&) r rÚ contextlibrrr rÚcontextmanagerr rr&rrrrÚs