Current File : //lib/python3.9/site-packages/pip/_internal/utils/__pycache__/unpacking.cpython-39.pyc |
a
[��f�# � @ s� d Z ddlZddlZddlZddlZddlZddlZddlmZm Z m
Z
ddlmZ ddlm
Z
ddlmZmZmZmZ ddlmZ e�e�Zee ZzddlZee7 ZW n ey� e�d� Y n0 zddlZee7 ZW n ey� e�d � Y n0 ed
�dd�Zee e d
�dd�Z ee e!d�dd�Z"eee!d�dd�Z#edd
�dd�Z$ee!d�dd�Z%d%eee!dd�dd�Z&eedd�d d!�Z'd&eee
e 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 �A/usr/lib/python3.9/site-packages/pip/_internal/utils/unpacking.py�
current_umask+ s
r )�pathr c C sh | � d�� d�} d| v rHd| v r4| �d�| �d�k s<d| vrH| �dd�S d| v r\| �dd�S | dgS d S )N�/�\� � )�lstrip�find�split�r r r r �split_leading_dir2 s ���r )�pathsr c C sD d}| D ]6}t |�\}}|s" dS |du r0|}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 Z
common_prefixr �prefix�restr r r �has_leading_dir>