Your IP : 18.191.195.180


Current Path : /opt/alt/python27/lib/python2.7/site-packages/pip/_internal/utils/
Upload File :
Current File : //opt/alt/python27/lib/python2.7/site-packages/pip/_internal/utils/unpacking.pyc

�
�Rec@@s�dZddlmZddlZddlZddlZddlZddlZddlZddl	m
Z
ddlmZm
Z
mZmZddlmZddlmZer�ddlmZmZmZmZmZdd	lmZneje�Zee
ZyddlZee7ZWne k
rDej!d
�nXyddl"Z"ee7ZWne k
rej!d�nXd�Z#d
�Z$d�Z%d�Z&d�Z'd�Z(e)d�Z*d�Z+dd�Z-dS(sUtilities related archives.
i(tabsolute_importN(tInstallationError(tBZ2_EXTENSIONStTAR_EXTENSIONSt
XZ_EXTENSIONStZIP_EXTENSIONS(t
ensure_dir(tMYPY_CHECK_RUNNING(tIterabletListtOptionaltTexttUnion(tZipInfosbz2 module is not availableslzma module is not availablecC@s tjd�}tj|�|S(sBGet the current umask which involves having to set it temporarily.i(tostumask(tmask((s�/builddir/build/BUILDROOT/alt-python27-pip-20.2.4-5.el8.x86_64/opt/alt/python27/lib/python2.7/site-packages/pip/_internal/utils/unpacking.pyt
current_umask/s
cC@s�|jd�jd�}d|krjd|krN|jd�|jd�ksZd|krj|jdd�Sd|kr�|jdd�S|dgSdS(Nt/s\it(tlstriptfindtsplit(tpath((s�/builddir/build/BUILDROOT/alt-python27-pip-20.2.4-5.el8.x86_64/opt/alt/python27/lib/python2.7/site-packages/pip/_internal/utils/unpacking.pytsplit_leading_dir7s*cC@s\d}xO|D]G}t|�\}}|s/tS|dkrD|}q
||kr
tSq
WtS(syReturns true if all the paths have the same leading path name
    (i.e., everything is in one subdirectory in an archive)N(tNoneRtFalsetTrue(tpathst
common_prefixRtprefixtrest((s�/builddir/build/BUILDROOT/alt-python27-pip-20.2.4-5.el8.x86_64/opt/alt/python27/lib/python2.7/site-packages/pip/_internal/utils/unpacking.pythas_leading_dirGs
	cC@sFtjj|�}tjj|�}tjj||g�}||kS(sL
    Return true if the absolute path of target is within the directory
    (RRtabspathtcommonprefix(t	directoryttargett
abs_directoryt
abs_targetR((s�/builddir/build/BUILDROOT/alt-python27-pip-20.2.4-5.el8.x86_64/opt/alt/python27/lib/python2.7/site-packages/pip/_internal/utils/unpacking.pytis_within_directoryWscC@s tj|dt�@dB�dS(sx
    Make file present at path have execute for user/group/world
    (chmod +x) is no-op on windows per python docs
    i�iIN(RtchmodR(R((s�/builddir/build/BUILDROOT/alt-python27-pip-20.2.4-5.el8.x86_64/opt/alt/python27/lib/python2.7/site-packages/pip/_internal/utils/unpacking.pyt2set_extracted_file_to_default_mode_plus_executablecscC@s0|jd?}t|o,tj|�o,|d@�S(NiiI(t
external_attrtbooltstattS_ISREG(tinfotmode((s�/builddir/build/BUILDROOT/alt-python27-pip-20.2.4-5.el8.x86_64/opt/alt/python27/lib/python2.7/site-packages/pip/_internal/utils/unpacking.pytzip_item_is_executablels
c
C@s�t|�t|d�}zatj|dt�}t|j��oF|}x-|j�D]}|j}|}|r�t	|�d}nt
jj||�}t
jj
|�}	t||�s�d}
t|
j|||���n|jd�s�|jd�r	t|�qVt|	�|j|�}z,t|d��}tj||�WdQXWd|j�t|�rtt|�nXqVWWd|j�XdS(	s�
    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.
    trbt
allowZip64isQThe zip file ({}) has a file ({}) trying to install outside target directory ({})Rs\twbN(RtopentzipfiletZipFileRR tnamelisttinfolisttfilenameRRRtjointdirnameR'RtformattendswithtshutiltcopyfileobjtcloseR0R)(
R9tlocationtflattentzipfptziptleadingR.tnametfntdirtmessagetfptdestfp((s�/builddir/build/BUILDROOT/alt-python27-pip-20.2.4-5.el8.x86_64/opt/alt/python27/lib/python2.7/site-packages/pip/_internal/utils/unpacking.pyt
unzip_filets4

	


cC@s�t|�|j�jd�s4|j�jd�r=d}np|j�jt�r[d}nR|j�jt�ryd}n4|j�jd�r�d}ntjd|�d	}tj||�}z�t	g|j
�D]}|j^q��}x�|j
�D]�}|j}|rt|�d
}nt
jj||�}t||�sgd}t|j|||���n|j�r�t|�q�|j�r�y|j||�Wq�tk
r�}	tjd||j|	�q�q�Xq�y|j|�}
Wn5ttfk
r}	tjd||j|	�q�nXtt
jj|��|
dk	sHt�t|d
��}tj|
|�WdQX|
j�|j ||�|j!d@r�t"|�q�q�WWd|j�XdS(s�
    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.
    s.gzs.tgzsr:gzsr:bz2sr:xzs.tartrs-Cannot determine compression type for file %ssr:*isQThe tar file ({}) has a file ({}) trying to install outside target directory ({})s/In the tar file %s the member %s is invalid: %sR3NiI(#RtlowerR=RRtloggertwarningttarfileR4R t
getmembersRFRRRR:R'RR<tisdirtissymt_extract_membert	ExceptiontextractfiletKeyErrortAttributeErrorR;RtAssertionErrorR>R?R@tutimeR/R)(R9RAR/ttartmemberRERGRRItexcRJRK((s�/builddir/build/BUILDROOT/alt-python27-pip-20.2.4-5.el8.x86_64/opt/alt/python27/lib/python2.7/site-packages/pip/_internal/utils/unpacking.pyt
untar_file�sf

*				
%	



cC@s�tjj|�}|dksB|j�jt�sBtj|�rbt||d|jd��ns|dks�t	j
|�s�|j�jttt
�r�t||�n+tjd|||�tdj|���dS(Nsapplication/zipRBs.whlsapplication/x-gzipsZCannot unpack file %s (downloaded from %s, content-type: %s); cannot detect archive formats%Cannot determine archive format of {}(RRtrealpathRNR=RR5t
is_zipfileRLRQt
is_tarfileRRRR_ROtcriticalRR<(R9RAtcontent_type((s�/builddir/build/BUILDROOT/alt-python27-pip-20.2.4-5.el8.x86_64/opt/alt/python27/lib/python2.7/site-packages/pip/_internal/utils/unpacking.pytunpack_file�s$
(.t__doc__t
__future__RtloggingRR>R,RQR5tpip._internal.exceptionsRtpip._internal.utils.filetypesRRRRtpip._internal.utils.miscRtpip._internal.utils.typingRttypingRR	R
RRR
t	getLoggert__name__ROtSUPPORTED_EXTENSIONStbz2tImportErrortdebugtlzmaRRR R'R)R0RRLR_RRe(((s�/builddir/build/BUILDROOT/alt-python27-pip-20.2.4-5.el8.x86_64/opt/alt/python27/lib/python2.7/site-packages/pip/_internal/utils/unpacking.pyt<module>sF"(


							/	V

?>