관리-도구
편집 파일: dirtools.cpython-36.pyc
3 �Rei � @ sZ d dl Z d dlZd dlZd dlZd dlZd dlZd dlZejdd� �Zdd� Z dd� Z dS )� Nc c s$ t j� } z | V W dtj| � X dS )z2Create a temporary directory in a context manager.N)�tempfile�mkdtemp�shutil�rmtree)�td� r ��/builddir/build/BUILDROOT/alt-python36-pip-20.2.4-5.el8.x86_64/opt/alt/python36/lib/python3.6/site-packages/pip/_vendor/pep517/dirtools.py�tempdir s r c O sB yt j| |�S tk r< } z|jtjkr,� W Y dd}~X 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 j� }tj|d�}x�tj| �D ]z\} }}x8|D ]0}tjj| |�}tjj|| �}|j |d d� q0W x4|D ],}tjj| |�}tjj|| �}|j ||� 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&