관리-도구
편집 파일: dirtools.cpython-39.opt-1.pyc
a [��fi � @ 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 �<module> s