JFIF$        dd7 

Viewing File: /usr/lib/python3.9/site-packages/pip/_internal/utils/__pycache__/unpacking.cpython-39.pyc

a

[��f�#�@s�dZddlZddlZddlZddlZddlZddlZddlmZm	Z	m
Z
ddlmZddlm
Z
ddlmZmZmZmZddlmZe�e�ZeeZzddlZee7ZWney�e�d�Yn0zddlZee7ZWney�e�d	�Yn0ed
�dd�Zee	ed
�dd�Z eee!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
edd"�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)�returncCst�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)�pathrcCsh|�d��d�}d|vrHd|vr4|�d�|�d�ks<d|vrH|�dd�Sd|vr\|�dd�S|dgSdS)N�/�\��)�lstrip�find�split�rrrr�split_leading_dir2s���r)�pathsrcCsDd}|D]6}t|�\}}|s"dS|dur0|}q||krdSqdS)zyReturns true if all the paths have the same leading path name
    (i.e., everything is in one subdirectory in an archive)NFT)r)rZ
common_prefixr�prefix�restrrr�has_leading_dir>sr )�	directory�targetrcCs0tj�|�}tj�|�}tj�||g�}||kS)zL
    Return true if the absolute path of target is within the directory
    )r
r�abspath�commonprefix)r!r"Z
abs_directoryZ
abs_targetrrrr�is_within_directoryMsr%cCst�|dt�@dB�dS)zx
    Make file present at path have execute for user/group/world
    (chmod +x) is no-op on windows per python docs
    i��IN)r
�chmodrrrrr�2set_extracted_file_to_default_mode_plus_executableXsr()�inforcCs$|jd?}t|o t�|�o |d@�S)N�r&)Z
external_attr�bool�stat�S_ISREG)r)�moderrr�zip_item_is_executable`s
r/T)�filename�location�flattenrc
	CsRt|�t|d�}�z.tj|dd�}t|���o2|}|��D]�}|j}|}|rZt|�d}t	j
�||�}t	j
�|�}	t
||�s�d}
t|
�|||���|�d�s�|�d�r�t|�q<t|	�|�|�}zTt|d��}t�||�Wd	�n1s�0YW|��t|��r6t|�q<|��t|��r4t|�0q<W|��n
|��0d	S)
a�
    Unzip the file (with path `filename`) to the destination `location`.  All
    files are written based on system defaults and umask (i.e. permissions are
    not preserved), except that regular file members with any execute
    permissions (user, group, or world) have "chmod +x" applied after being
    written. Note that for windows, any execute changes using os.chmod are
    no-ops per the python docs.
    �rbT)Z
allowZip64rzQThe zip file ({}) has a file ({}) trying to install outside target directory ({})rr�wbN)r�open�zipfile�ZipFiler Znamelist�infolistr0rr
r�join�dirnamer%r�format�endswith�shutil�copyfileobj�closer/r()
r0r1r2Zzipfp�zip�leadingr)�name�fn�dir�message�fp�destfprrr�
unzip_filegs<	

�

,

�
rH)r0r1rcCs�t|�|���d�s$|���d�r*d}nL|���t�r>d}n8|���t�rRd}n$|���d�rfd}nt�d|�d	}tj||d
d�}�z�t	dd
�|�
�D��}|�
�D�]�}|j}|r�t|�d}t
j�||�}t||�s�d}t|�|||���zt�|j|d�|�Wntj�y Yn0|���r6t|�q�|���r�z|�||�WnDt�y�}	z*t�d||j|	�WYd}	~	q�WYd}	~	n
d}	~	00q�z|�|�}
WnHttf�y�}	z*t�d||j|	�WYd}	~	q�WYd}	~	n
d}	~	00tt
j�|��|
du�sJ�t|d��}t�|
|�Wd�n1�s<0Y|
� �|�!||�|j"d@r�t#|�q�W|� �n
|� �0dS)a�
    Untar the file (with path `filename`) to the destination `location`.
    All files are written based on system defaults and umask (i.e. permissions
    are not preserved), except that regular file members with any execute
    permissions (user, group, or world) have "chmod +x" applied after being
    written.  Note that for windows, any execute changes using os.chmod are
    no-ops per the python docs.
    z.gzz.tgzzr:gzzr:bz2zr:xzz.tar�rz-Cannot determine compression type for file %szr:*zutf-8)�encodingcSsg|]
}|j�qSr�rB)�.0�memberrrr�
<listcomp>��zuntar_file.<locals>.<listcomp>rzQThe tar file ({}) has a file ({}) trying to install outside target directory ({})rKz/In the tar file %s the member %s is invalid: %sNr4r&)$r�lowerr<rr	�loggerZwarning�tarfiler5r Z
getmembersrBrr
rr9r%rr;Zdata_filter�replaceZLinkOutsideDestinationError�isdirZissymZ_extract_member�	ExceptionZextractfile�KeyError�AttributeErrorr:r=r>r?�utimer.r()r0r1r.�tarrArMrCrrE�excrFrGrrr�
untar_file�s|	�
�


�$�",
r[)r0r1�content_typercCs�tj�|�}|dks,|���t�s,t�|�rDt|||�d�d�nR|dkslt	�
|�sl|���ttt
�rxt||�nt�d|||�td|����dS)Nzapplication/zipz.whl)r2zapplication/x-gzipzZCannot unpack file %s (downloaded from %s, content-type: %s); cannot detect archive formatz#Cannot determine archive format of )r
r�realpathrPr<r
r6�
is_zipfilerHrRZ
is_tarfilerrr	r[rQZcriticalr)r0r1r\rrr�unpack_file�s,�������r_)T)N))�__doc__Zloggingr
r=r,rRr6�typingrrrrZpip._internal.exceptionsrZpip._internal.utils.filetypesrrr	r
Zpip._internal.utils.miscrZ	getLogger�__name__rQZSUPPORTED_EXTENSIONS�bz2�ImportError�debug�lzma�intr�strrr+r r%r(r/rHr[r_rrrr�<module>sL
.[��
Back to Directory  nL+D550H?Mx ,D"v]qv;6*Zqn)ZP0!1 A "#a$2Qr D8 a Ri[f\mIykIw0cuFcRı?lO7к_f˓[C$殷WF<_W ԣsKcëIzyQy/_LKℂ;C",pFA:/]=H  ~,ls/9ć:[=/#f;)x{ٛEQ )~ =𘙲r*2~ a _V=' kumFD}KYYC)({ *g&f`툪ry`=^cJ.I](*`wq1dđ#̩͑0;H]u搂@:~וKL Nsh}OIR*8:2 !lDJVo(3=M(zȰ+i*NAr6KnSl)!JJӁ* %݉?|D}d5:eP0R;{$X'xF@.ÊB {,WJuQɲRI;9QE琯62fT.DUJ;*cP A\ILNj!J۱+O\͔]ޒS߼Jȧc%ANolՎprULZԛerE2=XDXgVQe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