OwlCyberSecurity - MANAGER
Edit File: unpacking.cpython-39.pyc
a �F�f�. � @ s� d Z ddlZddlZddlZddlZddlZddlZddlZddlm Z m Z mZ ddlmZ ddl mZ ddlmZmZmZmZ ddlmZ e�e�Zee ZzddlZee7 ZW n ey� e�d� Y n0 zddlZee7 ZW n e�y e�d � Y n0 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 �_/home/gouroczh/virtualenv/test/3.9/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_dir3 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? 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! r"