관리-도구
편집 파일: unpacking.cpython-38.pyc
U &?�f�. � @ s� d Z ddlZddlZddlZddlZddlZddlZddlZddlm Z m Z mZ ddlmZ ddl mZ ddlmZmZmZmZ ddlmZ e�e�Zee ZzddlZee7 ZW n ek r� e�d� Y nX zddlZee7 ZW n ek �r e�d � Y nX ed �dd�Ze e e d �dd�Z!e e e"d�dd�Z#e e e"d�dd�Z$ed �dd�Z%e dd �dd�Z&ee"d�dd�Z'd*e e e"dd�dd �Z(e e dd!�d"d#�Z)e e ej*e"dd$�d%d&�Z+d+e e ee dd'�d(d)�Z,dS ),zUtilities related archives. � N)�Iterable�List�Optional)�ZipInfo)�InstallationError)�BZ2_EXTENSIONS�TAR_EXTENSIONS� XZ_EXTENSIONS�ZIP_EXTENSIONS)� ensure_dirzbz2 module is not availablezlzma module is not available)�returnc C s t �d�} t �| � | S )zBGet the current umask which involves having to set it temporarily.r )�os�umask)�mask� r �K/opt/hc_python/lib/python3.8/site-packages/pip/_internal/utils/unpacking.py� current_umask, s r )�pathr c C sh | � d�� d�} d| krHd| kr4| �d�| �d�k s<d| krH| �dd�S d| kr\| �dd�S | dgS d S )N�/�\� � )�lstrip�find�split�r r r r �split_leading_dir3 s ���r )�pathsr c C sD d}| D ]6}t |�\}}|s" dS |dkr0|}q||kr dS qdS )zyReturns true if all the paths have the same leading path name (i.e., everything is in one subdirectory in an archive)NFT)r )r � common_prefixr �prefix�restr r r �has_leading_dir? s r! )� directory�targetr c C s0 t j�| �}t j�|�}t j�||g�}||kS )zL Return true if the absolute path of target is within the directory )r r �abspath�commonprefix)r"