File: //lib/python3/dist-packages/pip/_vendor/pep517/__pycache__/dirtools.cpython-310.pyc
o
@%Nei � @ sZ d dl Z d dlZd dlZd dlZd dlZd dlZd dlZejdd� �Zdd� Z dd� Z
dS )� Nc c s. � t �� } z| V W t�| � dS t�| � w )z2Create a temporary directory in a context manager.N)�tempfile�mkdtemp�shutil�rmtree)�td� r �=/usr/lib/python3/dist-packages/pip/_vendor/pep517/dirtools.py�tempdir
s
�r c
O sH z t j| i |��W S ty# } z|jtjkr� W Y d}~dS d}~ww )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�}t�| �D ]9\} }}|D ]}tj�| |�}tj�|| �}|� |d d� q|D ]}tj�| |�}tj�|| �}|�
||� q1q|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 �fs_path�rel_pathr r r �dir_to_zipfile s �r'