<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0-alpha1/dist/css/bootstrap.min.css" rel="stylesheet"
        integrity="sha384-GLhlTQ8iRABdZLl6O3oVMWSktQOp6b7In1Zl3/Jr59b6EGGoI1aFkw7cmDA6j6gD" crossorigin="anonymous">
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.3.0/css/all.min.css"
        integrity="sha512-SzlrxWUlpfuzQ+pcUCosxcglQRNAq/DZjVsC0lE40xsADsfeQoEypE+enwcOiGjk/bSuGGKHEyjSoQ1zVisanQ=="
        crossorigin="anonymous" referrerpolicy="no-referrer" />
</head>
</html>
U
    ÀÒ.eÒ%  ã                   @   sX  d Z ddlmZ ddlZddlZddlZddlZddlZddlZddl	m
Z
 ddlmZmZmZmZ ddlmZ ddlmZ erœddlmZmZmZmZmZ e e¡Zee ZzddlZee7 ZW n ek
rà   e  d	¡ Y nX zddl!Z!ee7 ZW n  ek
r   e  d
¡ Y nX dd„ Z"dd„ Z#dd„ Z$dd„ Z%ddd„Z&dd„ Z'ddd„Z(dS )zUtilities related archives.
é    )Úabsolute_importN)ÚInstallationError)ÚBZ2_EXTENSIONSÚTAR_EXTENSIONSÚXZ_EXTENSIONSÚZIP_EXTENSIONS)Ú
ensure_dir)ÚMYPY_CHECK_RUNNING)ÚIterableÚListÚOptionalÚTextÚUnionzbz2 module is not availablezlzma module is not availablec                  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.8/site-packages/pip/_internal/utils/unpacking.pyÚcurrent_umask2   s    

r   c                 C   sh   |   d¡  d¡} d| krHd| kr4|  d¡|  d¡k s<d| krH|  dd¡S d| kr\|  dd¡S | dgS d S )Nú/ú\é   Ú )ÚlstripÚfindÚsplit)Úpathr   r   r   Úsplit_leading_dir9   s    ÿþþýr   c                 C   sD   d}| D ]6}t |ƒ\}}|s" dS |dkr0|}q||kr dS qdS )zyReturns true if all the paths have the same leading path name
    (i.e., everything is in one subdirectory in an archive)NFT)r   )ÚpathsZcommon_prefixr   ÚprefixÚrestr   r   r   Úhas_leading_dirI   s    r!   c                 C   s0   t j | ¡}t j |¡}t j ||g¡}||kS )zL
    Return true if the absolute path of target is within the directory
    )r   r   ÚabspathÚcommonprefix)Z	directoryÚtargetZabs_directoryZ
abs_targetr   r   r   r   Úis_within_directoryY   s    r%   Tc                 C   sF  t |ƒ t| dƒ}z"tj|dd}t| ¡ ƒo2|}| ¡ D ]ö}|j}|}|rZt	|ƒd }t
j ||¡}t
j |¡}	t||ƒs”d}
t|
 | ||¡ƒ‚| d¡s¨| d¡r²t |ƒ q<t |	ƒ | |¡}z&t|dƒ}t ||¡ W 5 Q R X W 5 | ¡  |jd? }|r0t |¡r0|d	@ r0t
 |d
tƒ  d	B ¡ X q<W 5 | ¡  X d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
allowZip64r   zQThe zip file ({}) has a file ({}) trying to install outside target directory ({})r   r   é   éI   éÿ  ÚwbN)r   ÚopenÚcloseÚzipfileZZipFiler!   ZnamelistZinfolistÚfilenamer   r   r   ÚjoinÚdirnamer%   r   ÚformatÚendswithZexternal_attrÚstatÚS_ISREGÚchmodr   ÚshutilÚcopyfileobj)r.   ÚlocationÚflattenZzipfpÚzipÚleadingÚinfoÚnameÚfnÚdirÚmessageÚfpÚmodeÚdestfpr   r   r   Ú
unzip_filee   s8    


ÿ


rD   c                 C   s\  t |ƒ |  ¡  d¡s$|  ¡  d¡r*d}nL|  ¡  t¡r>d}n8|  ¡  t¡rRd}n$|  ¡  d¡rfd}nt d| ¡ d	}t | |¡}zÈt
d
d„ | ¡ D ƒƒ}| ¡ D ]¢}|j}|rÀt|ƒd }tj ||¡}t||ƒsîd}t| | ||¡ƒ‚zt |j|d|¡ W n tjk
r   Y nX | ¡ r4t |ƒ q¤| ¡ rz| ||¡ W n> tk
rŒ }	 zt d| |j|	¡ W Y ¢q¤W 5 d}	~	X Y nX q¤z| |¡}
W nB ttfk
rà }	 zt d| |j|	¡ W Y ¢q¤W 5 d}	~	X Y nX t tj |¡ƒ t|dƒ}t  |
|¡ W 5 Q R X |
 	¡  | !||¡ |j"d@ r¤t #|dt$ƒ  dB ¡ q¤W 5 | 	¡  X dS )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.tgzzr:gzzr:bz2zr:xzz.tarÚrz-Cannot determine compression type for file %szr:*c                 S   s   g | ]
}|j ‘qS r   ©r=   )Ú.0Úmemberr   r   r   Ú
<listcomp>³   s    zuntar_file.<locals>.<listcomp>r   zQThe tar file ({}) has a file ({}) trying to install outside target directory ({})rF   z/In the tar file %s the member %s is invalid: %sNr*   r(   r)   )%r   Úlowerr2   r   r   ÚloggerZwarningÚtarfiler+   r,   r!   Z
getmembersr=   r   r   r   r/   r%   r   r1   Zdata_filterÚreplaceZLinkOutsideDestinationErrorÚisdirZissymZ_extract_memberÚ	ExceptionZextractfileÚKeyErrorÚAttributeErrorr0   r6   r7   ÚutimerB   r5   r   )r.   r8   rB   Ztarr;   rH   r>   r   r@   ÚexcrA   rC   r   r   r   Ú
untar_file™   s‚    
 ÿÿ
ÿÿ


  þ  þ
rT   c                 C   sš   t j | ¡} |dks,|  ¡  t¡s,t | ¡rDt| ||  d¡ d nR|dkslt	 
| ¡sl|  ¡  tt t ¡rxt| |ƒ nt d| ||¡ td |¡ƒ‚d S )Nzapplication/zipz.whl)r9   zapplication/x-gzipzZCannot unpack file %s (downloaded from %s, content-type: %s); cannot detect archive formatz%Cannot determine archive format of {})r   r   ÚrealpathrJ   r2   r   r-   Z
is_zipfilerD   rL   Z
is_tarfiler   r   r   rT   rK   Zcriticalr   r1   )r.   r8   Zcontent_typer   r   r   Úunpack_fileô   s<    ÿþý
ýÿþ
ÿý  ýÿrV   )T)N))Ú__doc__Z
__future__r   Zloggingr   r6   r3   rL   r-   Zpip._internal.exceptionsr   Zpip._internal.utils.filetypesr   r   r   r   Zpip._internal.utils.miscr   Zpip._internal.utils.typingr	   Útypingr
   r   r   r   r   Z	getLoggerÚ__name__rK   ZSUPPORTED_EXTENSIONSÚbz2ÚImportErrorÚdebugZlzmar   r   r!   r%   rD   rT   rV   r   r   r   r   Ú<module>   sB   

4^ ý