£Á°è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>
B
    Re%                 @   st  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 dd	lmZ eeZee ZyddlZee7 ZW n e k
r   e!d
 Y nX y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 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Union)ZipInfoz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   /builddir/build/BUILDROOT/alt-python37-pip-20.2.4-6.el8.x86_64/opt/alt/python37/lib/python3.7/site-packages/pip/_internal/utils/unpacking.pycurrent_umask/   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_dir7   s    r   c             C   sD   d}x:| D ]2}t |\}}|s"dS |dkr0|}q
||kr
dS q
W 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   )pathscommon_prefixr   prefixrestr   r   r   has_leading_dirG   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)	directorytargetabs_directory
abs_targetr!   r   r   r   is_within_directoryW   s    r*   c             C   s   t | dt  @ dB  dS )zx
    Make file present at path have execute for user/group/world
    (chmod +x) is no-op on windows per python docs
    i  I   N)r   chmodr   )r   r   r   r   2set_extracted_file_to_default_mode_plus_executablec   s    r-   c             C   s$   | j d? }t|o t|o |d@ S )N   r+   )external_attrboolstatS_ISREG)infomoder   r   r   zip_item_is_executablel   s    
r5   Tc          
   C   s  t | t| d}ztj|dd}t| o0|}x| D ]}|j}|}|rZt|d }t	j
||}t	j
|}	t||sd}
t|
| |||ds|drt | q<t |	 ||}z&t|d}t|| W d	Q R X W d	|  t|rt| X q<W W d	|  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)
allowZip64r   zQThe zip file ({}) has a file ({}) trying to install outside target directory ({})r   r   wbN)r   openzipfileZipFiler#   namelistinfolistfilenamer   r   r   joindirnamer*   r   formatendswithshutilcopyfileobjcloser5   r-   )r>   locationflattenzipfpzipleadingr3   namefndirmessagefpdestfpr   r   r   
unzip_filet   s4    





rQ   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 }xr|
 D ]d}|j}|rt|d }tj||}t||sd}t|| ||| rt | q| r\y||| W n8 tk
rX }	 ztd| |j|	 wW dd}	~	X Y nX qy||}
W n< ttfk
r }	 ztd| |j|	 wW dd}	~	X Y nX t tj| |
dk	stt|d}t|
| W dQ R X |
  ||| |j d@ rt!| qW W d|  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   )rK   ).0memberr   r   r   
<listcomp>   s    zuntar_file.<locals>.<listcomp>r   zQThe tar file ({}) has a file ({}) trying to install outside target directory ({})z/In the tar file %s the member %s is invalid: %sNr8   r+   )"r   lowerrB   r   r   loggerwarningtarfiler9   r#   
getmembersrK   r   r   r   r?   r*   r   rA   isdirissym_extract_member	ExceptionextractfileKeyErrorAttributeErrorr@   AssertionErrorrC   rD   rE   utimer4   r-   )r>   rF   r4   tarrJ   rT   rL   r   rN   excrO   rP   r   r   r   
untar_file   sf    





rf   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)rG   zapplication/x-gzipzZCannot unpack file %s (downloaded from %s, content-type: %s); cannot detect archive formatz%Cannot determine archive format of {})r   r   realpathrV   rB   r   r:   
is_zipfilerQ   rY   
is_tarfiler   r   r   rf   rW   criticalr   rA   )r>   rF   content_typer   r   r   unpack_file   s$    


rl   )T)N),__doc__
__future__r   loggingr   rC   r1   rY   r:   pip._internal.exceptionsr   pip._internal.utils.filetypesr   r   r   r   pip._internal.utils.miscr   pip._internal.utils.typingr	   typingr
   r   r   r   r   r   	getLogger__name__rW   SUPPORTED_EXTENSIONSbz2ImportErrordebuglzmar   r   r#   r*   r-   r5   rQ   rf   rl   r   r   r   r   <module>   sF   
	
/V