B š•Rei ã @ sZ d dl Z d dlZd dlZd dlZd dlZd dlZd dlZejdd„ ƒZdd„ Z dd„ Z dS )é Nc c s$ t ¡ } z | V W dt | ¡ X dS )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 O sB yt j| |ŽS tk r< } z|jtjkr,‚ W dd}~X Y nX dS )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¡}xˆt | ¡D ]z\} }}x8|D ]0}tj | |¡}tj || ¡}| |d d¡ q0W x4|D ],}tj | |¡}tj || ¡}| ||¡ qjW q 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Úfilesr Zfs_pathÚrel_pathr r r Údir_to_zipfile s r&