관리-도구
편집 파일: dirtools.cpython-37.pyc
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&