Sindbad~EG File Manager
�
4Μg�. �
�N � d Z ddlZddlZddlZddlZddlZddlZddlZddlm Z m
Z
mZ ddlmZ ddl
mZ ddlmZmZmZmZ ddlmZ ej, e� Zeez Z ddlZeez
Z ddlZeez
Zd
efd�Zde d
e
e fd
�Z!de e d
e"fd�Z#de de d
e"fd�Z$d
efd�Z%de d
dfd�Z&ded
e"fd�Z'd!de de de"d
dfd�Z(de de d
dfd�Z)de de dejT de"d
df
d�Z+ d"de de dee d
dfd �Z,y# e$ r ej9 d� Y ��w xY w# e$ r ej9 d � Y ��w xY w)#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 �Z � t j d� } t j | � | S )zBGet the current umask which involves having to set it temporarily.r )�os�umask)�masks �H/usr/local/lib/python3.12/site-packages/pip/_internal/utils/unpacking.py�
current_umaskr , s � �
�8�8�A�;�D��H�H�T�N��K� �pathc � � | j d� j d� } d| v r=d| v r#| j d� | j d� k sd| vr| j dd� S d| v r| j dd� S | dgS )N�/�\� � )�lstrip�find�split�r s r �split_leading_dirr 3 sz � ��;�;�s��"�"�4�(�D�
�d�{�
���$�)�)�C�.�4�9�9�T�?�:�t�4�?O��z�z�#�q�!�!�
����z�z�$��"�"��b�z�r �pathsc �R � d}| D ] }t |� \ }}|s y|�|}�||k7 s� y y)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�rests r �has_leading_dirr% ? sB � � �M���(��.������
�
"�"�M�
�}�
$�� � r � directory�targetc �� � t j j | � }t j j |� }t j j ||g� }||k( S )zL
Return true if the absolute path of target is within the directory
)r r �abspath�commonprefix)r&