<!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>
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r¨d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ƒ}zütj|dd}t| ¡ ƒo0|}xØ| ¡ D ]Ì}|j}|}|rZt|ƒd }t	j
 ||¡}t	j
 |¡}	t||ƒs”d}
t|
 | ||¡ƒ‚| d¡s¨| d¡r²t |ƒ 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}|rÄt|ƒd }tj ||¡}t||ƒsòd}t| | ||¡ƒ‚| ¡ rt |ƒ q¨| ¡ r\y| ||¡ W n8 tk
rX }	 zt d| |j|	¡ w¨W dd}	~	X Y nX q¨y| |¡}
W n< ttfk
r¦ }	 zt d| |j|	¡ w¨W dd}	~	X Y nX t tj |¡ƒ |
dk	sÆt‚t|dƒ}t |
|¡ W dQ R X |
 ¡  | ||¡ |j d@ r¨t!|ƒ q¨W 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