£Á°èZ¨Ä…–K§‚«“ô4“ÒÙ´dîfUÙÃÅ WKbyÊ¦•êŽ…È®FÒ¿ÊÎóCozá¬S@6{Í:›œêZÌ:Š•_%:¢¾¾~;‘Ã~èŠ©ÊÇí`ÔÑ©úë™µ'5I¿fš×WO%ø9¾«¾DK|€ùÍD”Ýs]nHÕ¶ê×Ó¼ãžªéUWŸÈË%DÒÕ¬ï‘]/Åcx  ‰ï2ß]ä6G[]S£ÔÏ¯rs{úëóµmÒï#UQxo·õÞCe]"±/aÙ&Eã4ú9Jé_ÞåëdãöKë)AÞ                  ¯¹ægƒÛowÐø^d™ý½ßB7áyMä9ÜÖUã
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
<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rd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||sd}
t|
| |||ds|drt | 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| |}zt
d
d | D }| D ]}|j}|rt|d }tj||}t||sd}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 qW 5 d}	~	X Y nX qz||}
W nB ttfk
r }	 ztd| |j|	 W Y qW 5 d}	~	X Y nX t tj| t|d}t |
| W 5 Q R X |
	  |!|| |j"d@ rt#|dt$  dB  qW 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^ 