ok

Mini Shell

Direktori : /opt/alt/python33/lib/python3.3/site-packages/pip/
Upload File :
Current File : //opt/alt/python33/lib/python3.3/site-packages/pip/download.pyc

�
�2{Yc
@sddlZddlZddlZddlZddlZddlZddlZddlZddl	Z	ddl
Z
ddlZddlZddl
mZmZmZddlmZmZddlmZmZmZmZmZmZmZmZmZddlmZddl m!Z!ddl"m#Z#m$Z$ddl%m&Z&dd	l'm(Z(m)Z)dd
l*m+Z+ddl,m-Z-m.Z.ddl/m0Z0dd
l1m2Z2ddddddddddg
Z3d�Z4de(fd��YZ5de6fd��YZ7de&fd��YZ8de#j9fd ��YZ:ddd!�Z<ej=d"ej>�Z?ej=d#ej>�Z@d$�ZAd%�ZBej=d&ej>�ZCej=d'ej>�ZDd(�ZEd)�ZFeGd*�ZHd+�ZId,�ZJd-�ZKd.�ZLd/�ZMd0�ZNd1�ZOddd2�ZPdd3�ZQdS(4i����N(turllibturlparset	raw_input(tInstallationErrortHashMismatch(	tsplitexttrmtreetformat_sizetdisplay_patht
backup_dirtask_path_existstunpack_filetcreate_download_cache_foldertcache_download(tvcs(tlogger(trequeststsix(tBaseAdapter(tAuthBaset
HTTPBasicAuth(tIncompleteRead(t
InvalidURLtChunkedEncodingError(tResponse(tCaseInsensitiveDicttget_file_contenttis_urlturl_to_pathtpath_to_urltis_archive_filetunpack_vcs_linktunpack_file_urlt
is_vcs_urltis_file_urltunpack_http_urlcCs4tj�}|dkr'tj�}n�|dkr�dtjjtjjtjjf}tjjdkr�dj	|tjjg�}q�n<|dkr�tj�}n!|dkr�tj�}nd}ytj
�}tj�}Wntk
rd}d}nXd	j	d
t
jd||fd||fg�S(s,Return a string representing the user agent.tCPythontPyPys%s.%s.%stfinalttJythont
IronPythontUnknownt spip/%ss%s/%s(tplatformtpython_implementationtpython_versiontsystpypy_version_infotmajortminortmicrotreleaseleveltjointsystemtreleasetIOErrortpipt__version__(t_implementationt_implementation_versiontp_systemt	p_release((s=/opt/alt/python33/lib/python3.3/site-packages/pip/download.pyt
user_agent$s2	


tMultiDomainBasicAuthcBs/eZed�Zd�Zd�Zd�ZRS(cCs||_i|_dS(N(t	promptingt	passwords(tselfRA((s=/opt/alt/python33/lib/python3.3/site-packages/pip/download.pyt__init__Hs	cCs�tj|j�}|jjdd�d}tj|d |f|d�|_|jj|d�\}}|dkr�|j|j�\}}n|s�|r�||f|j|<t	|p�d|p�d�|�}n|j
d|j�|S(Nt@ii����iR'tresponse(NN(Rturltnetloctsplitt
urlunparseRBtgettNonetparse_credentialsRt
register_hookt
handle_401(RCtreqtparsedRHtusernametpassword((s=/opt/alt/python33/lib/python3.3/site-packages/pip/download.pyt__call__Ls%$cKs�|jdkr|S|js |Stj|j�}td|j�}tjd�}|s`|ry||f|j|j<n|j|j	j
�t|p�d|p�d�|j�}|j
j||�}|jj|�|S(Ni�s
User for %s: s
Password: R'(tstatus_codeRARRGRRHtgetpassRBtcontenttrawtrelease_connRtrequestt
connectiontsendthistorytappend(RCtresptkwargsRQRRRSRPtnew_resp((s=/opt/alt/python33/lib/python3.3/site-packages/pip/download.pyROhs	
$cCsLd|krH|jdd�d}d|kr>|jdd�S|dfSdS(NREiit:(NN(trsplitRIRL(RCRHtuserinfo((s=/opt/alt/python33/lib/python3.3/site-packages/pip/download.pyRM�s
(t__name__t
__module__tTrueRDRTRORM(((s=/opt/alt/python33/lib/python3.3/site-packages/pip/download.pyR@Fs		"tLocalFSResponsecBs;eZd�Zd�Zdded�Zed��ZRS(cCs
||_dS(N(tfileobj(RCRi((s=/opt/alt/python33/lib/python3.3/site-packages/pip/download.pyRD�scCst|j|�S(N(tgetattrRi(RCtname((s=/opt/alt/python33/lib/python3.3/site-packages/pip/download.pyt__getattr__�scCs|jj|�S(N(Ritread(RCtamttdecode_contentt
cache_content((s=/opt/alt/python33/lib/python3.3/site-packages/pip/download.pyRm�scs9dtfd��Y�dtf�fd��Y}|�S(NtFakeMessagecBseZd�Zd�ZRS(cSsgS(N((RCtheader((s=/opt/alt/python33/lib/python3.3/site-packages/pip/download.pyt
getheaders�scSsgS(N((RCRrtdefault((s=/opt/alt/python33/lib/python3.3/site-packages/pip/download.pytget_all�s(ReRfRsRu(((s=/opt/alt/python33/lib/python3.3/site-packages/pip/download.pyRq�s	tFakeResponsecseZe�fd��ZRS(cs��S(N((RC(Rq(s=/opt/alt/python33/lib/python3.3/site-packages/pip/download.pytmsg�s(ReRftpropertyRw((Rq(s=/opt/alt/python33/lib/python3.3/site-packages/pip/download.pyRv�s(tobject(RCRv((Rqs=/opt/alt/python33/lib/python3.3/site-packages/pip/download.pyt_original_response�sN(	ReRfRDRlRLtFalseRmRxRz(((s=/opt/alt/python33/lib/python3.3/site-packages/pip/download.pyRh�s		tLocalFSAdaptercBs)eZdddddd�Zd�ZRS(c
Cstj|j�}|jj�dkr=td|j��ntj|d d|d�}t|�}	t�}
d|
_||
_t	j
|	�}tjj
|jdt�}titj|	�dp�d	d
6|jd6|d6�|
_tt|	d
��|
_|
jj|
_|
S(Nt	localhosts)Invalid URL %r: Only localhost is allowediR'ii�tusegmtis
text/plainsContent-TypesContent-Lengths
Last-Modifiedtrb(R'(RRGRHtlowerRRJRRRUtoststattemailtutilst
formatdatetst_mtimeRgRt	mimetypest
guess_typetst_sizetheadersRhtopenRXtclose(
RCRZtstreamttimeouttverifytcerttproxiest
parsed_urltreal_urltpathnameR_tstatstmodified((s=/opt/alt/python33/lib/python3.3/site-packages/pip/download.pyR\�s$			
cCsdS(N((RC((s=/opt/alt/python33/lib/python3.3/site-packages/pip/download.pyR��sN(ReRfRLR\R�(((s=/opt/alt/python33/lib/python3.3/site-packages/pip/download.pyR|�st
PipSessioncBs eZdZd�Zd�ZRS(cOsLtt|�j||�t�|jd<t�|_|jdt��dS(Ns
User-Agentsfile://(	tsuperR�RDR?R�R@tauthtmountR|(RCtargsR`((s=/opt/alt/python33/lib/python3.3/site-packages/pip/download.pyRD�scOsrtj|�}|jdkr@tj|d d|d�}n|jd|j�tt|�j||||�S(NtfileiR}iR�(s	localhost(RtschemeRJt
setdefaultR�R�R�RZ(RCtmethodRGR�R`RQ((s=/opt/alt/python33/lib/python3.3/site-packages/pip/download.pyRZ�s
"N(ReRfRLR�RDRZ(((s=/opt/alt/python33/lib/python3.3/site-packages/pip/download.pyR��s	c
Cs�|d
krt�}ntj|�}|rq|jd�j�}|dkr||r||jd�r|td||f��n|dkr,|jdd�d}|j	dd�}t
j|�}|r�|jd�d|jdd�d}ntj
|�}|jd�r#d|jd�}n|}qq|j|�}|j�tjr^|j|jfS|j|jfSnyt|�}|j�}Wn7tk
r�tj�d}	td	t|	���nX|j�||fS(s�Gets the content of a file; it may be a filename, file: URL, or
    http: URL.  Returns (location, content).  Content is unicode.iR�thttps6Requirements file %s references URL %s, which is localRbs\t/t|s$Could not open requirements file: %sN(RLR�t
_scheme_retsearchtgroupR�t
startswithRRItreplacet_url_slash_drive_retmatchRtunquotetlstripRKtraise_for_statusRtPY3RGttextRWR�RmR8R/texc_infotstrR�(
RGt
comes_fromtsessionR�R�tpathR_tfRWte((s=/opt/alt/python33/lib/python3.3/site-packages/pip/download.pyR�sB*	
	

s^(http|https|file):s/*([a-z])\|cCsId|krtS|jdd�dj�}|ddddgtjkS(s)Returns true if the name looks like a URLRbiiR�thttpsR�tftp(R{RIR�Rtall_schemes(RkR�((s=/opt/alt/python33/lib/python3.3/site-packages/pip/download.pyR scCs}|jd�std|��|td�jd�}tj|�}tj|�ro|dd|d}n
d|}|S(s(
    Convert a file: URL to a path.
    sfile:s4You can only turn file: urls into filenames (not %r)R�iRbi(R�tAssertionErrortlenR�RR�t
_url_drive_reR�(RGR�((s=/opt/alt/python33/lib/python3.3/site-packages/pip/download.pyR(s

s	^([a-z]):s^([a-z])[:|]cCs�tjjtjj|��}tjj|�\}}|jtjj�}djg|D]}tj	|�^qX�}|s�|j
d�}nd||S(sh
    Convert a path to a file: URL.  The path will be made absolute and have
    quoted path parts.
    R�sfile:///(R�R�tnormpathtabspatht
splitdriveRItsepR5RtquoteR�(R�tdrivetfilepathtpartRG((s=/opt/alt/python33/lib/python3.3/site-packages/pip/download.pyR;s+cCs0d	}t|�dj�}||kr,tStS(
s9Return True if `name` is a considered as an archive file.s.zips.tar.gzs.tar.bz2s.tgzs.tars	.pybundles.whli(s.zips.tar.gzs.tar.bz2s.tgzs.tars	.pybundles.whl(RR�RgR{(Rktarchivestext((s=/opt/alt/python33/lib/python3.3/site-packages/pip/download.pyRIscCs3t|�}|r"|j|�n
|j|�dS(N(t_get_used_vcs_backendtexporttunpack(tlinktlocationt
only_downloadtvcs_backend((s=/opt/alt/python33/lib/python3.3/site-packages/pip/download.pyRSscCs=x6tjD]+}|j|jkr
||j�}|Sq
WdS(N(RtbackendsR�tschemesRG(R�tbackendR�((s=/opt/alt/python33/lib/python3.3/site-packages/pip/download.pyR�[scCstt|��S(N(tboolR�(R�((s=/opt/alt/python33/lib/python3.3/site-packages/pip/download.pyR!bscCs|jj�jd�S(Nsfile:(RGR�R�(R�((s=/opt/alt/python33/lib/python3.3/site-packages/pip/download.pyR"fscCs�|jtj|j�jkrQtjd|j||jf�td|��n|j�|jkr�tjd||j�|jf�td|j|f��ndS(NsPHash digest size of the package %d (%s) doesn't match the expected hash name %s!s!Hash name mismatch for package %ss?Hash of the package %s (%s) doesn't match the expected hash %s!sBad %s hash for package %s(	tdigest_sizethashlibtnewt	hash_nameRtfatalRt	hexdigestthash(t
download_hashR�((s=/opt/alt/python33/lib/python3.3/site-packages/pip/download.pyt_check_hashjs		cCs�ytj|j�}Wn2ttfk
rJtjd|j|f�dSXt|d�}x0t	r�|j
d�}|s|Pn|j|�q]W|j�|S(Ns'Unsupported hash name %s for package %sRi(
R�R�R�t
ValueErrort	TypeErrorRtwarnRLR�RgRmtupdateR�(ttarget_fileR�R�tfptchunk((s=/opt/alt/python33/lib/python3.3/site-packages/pip/download.pyt_get_hash_from_fileus	
c	st|d�}d}|jrn|jrnytj|j�}Wqntk
rjtjd|j|f�qnXnyt	�j
d�}Wn tttfk
r�d}nXd}|dkp�|}|j
}z|r
|r�tjd|t|�f�qtjd|�ntjd	|�tjd
|��fd�}	x�|	d�D]�}
|t|
�7}|r�|s�tjd
t|��q�tjdd||t|�f�n|dk	r�|j|
�n|j|
�qKW|j�Wd|r
tjdt|��nX|S(Ntwbs'Unsupported hash name %s for package %sscontent-lengthii(i�sDownloading %s (%s): sDownloading %s (unknown size): sDownloading %ssDownloading from URL %sc3s�yRy,x%�jj|dt�D]}|VqWWntk
rP}t|��nXWn?tk
r�x/tr��jj|�}|s�Pn|VqeWnXdS(NRo(RXR�R{RRtAttributeErrorRgRm(t
chunk_sizeR�R�(R_(s=/opt/alt/python33/lib/python3.3/site-packages/pip/download.pyt	resp_read�s

	is%ss	%3i%%  %sids
%s downloadedi@�(R�RLR�R�R�R�R�RR�tintR�tKeyErrorR�tshow_urltstart_progressRtnotifytinfoR�t
show_progressR�twriteR�tend_progress(R_R�t
temp_locationR�R�ttotal_lengtht
downloadedR�R�R�R�((R_s=/opt/alt/python33/lib/python3.3/site-packages/pip/download.pyt
_download_url�sF
!
	 (cCst}tjj||j�}tjj|�r�tdt|�d�}|dkr^t}q�|dkr�t	j
dt|��tj|�q�|dkr�t|�}t	j
dt|�t|�f�t
j||�q�n|rt
j||�t	jdt|��ndS(	Ns/The file %s exists. (i)gnore, (w)ipe, (b)ackup titwtbsDeleting %ssBacking up %s to %ssSaved %s(R�R�R�(RgR�R�R5tfilenametexistsR
RR{RR�tremoveR	tshutiltmovetcopyR�(R�R�tcontent_typeR�R�tdownload_locationRFt	dest_file((s=/opt/alt/python33/lib/python3.3/site-packages/pip/download.pyt
_copy_file�s&		c
Cs�|dkrt�}ntjdd�}d}|jjdd�d}t}d}	d}
d}|r�tjj	|t
j|d��}	|	d}
tjj|	�o�tjj|
�}tjj
|�s�t|�q�nd}|rtjj	||j�}tjj|�sd}qn|r�|}tj|�d}
tjd|�|jr�t||�}yt||�Wq�tk
r�tjd	|�d}tj|�d}q�Xq�n|r�|r�t|
��}|j�j�}
WdQX|	}tjd
|	�|jr�|jr�t|	|�}yt||�Wq�tk
r~tjd|�d}tj|	�tj|
�t}q�Xq�n|sy#|j|dt�}|j �Wn6t!j"k
r�}tj#d
|j$j%|f��nX|j&jdd�}
|j}|j&jd�}|rJt'j(|�\}}|jd�pD|}nt)|�d}|s�tj*|
�}|r�||7}q�n|r�|j|jkr�tjj)|j�d}|r�||7}q�ntjj	||�}t+|||�}|jr|jrt||�qn|r<|r<t,|||
|�nt-|||
|�|	ro|rot.|	||
�n|px|s�tj|�ntj/|�dS(Ns-unpackspip-t#iiR's
.content-typesFile was already downloaded %ss;Previously-downloaded file %s has bad hash, re-downloading.sUsing download cache from %ss,Cached file %s has bad hash, re-downloading.R�sHTTP error %s while getting %sscontent-typescontent-dispositionR�(0RLR�ttempfiletmkdtempRGRIR{R�R�R5RR�R�tisdirRR�R�R�RR�R�R�R�RR�tunlinkR�RmtstripR�RKRgR�Rt	HTTPErrorR�RFRUR�tcgitparse_headerRtguess_extensionR�R�RR
trmdir(R�R�tdownload_cachetdownload_dirR�ttemp_dirR�t
target_urltalready_cachedt
cache_filetcache_content_type_fileR�talready_downloadedR�R�R_texcR�tcontent_dispositionttypetparamsR�((s=/opt/alt/python33/lib/python3.3/site-packages/pip/download.pyR#�s�
	





		

c
Cs�t|j�}t}tjj|�r`tjj|�rFt|�ntj||dt	�dS|j
r�t||�}t||�n|rLtjj
||j�}tjj|�rLtj|�d}tjd|�|j
r@t||�}yt||�t	}WqFtk
r<tjd|�tj|�qFXqIt	}qLn|r[|}	n|}	tj|	�d}t|	|||�|r�|r�t|	|||�ndS(NtsymlinksisFile was already downloaded %ss;Previously-downloaded file %s has bad hash, re-downloading.(Rturl_without_fragmentR{R�R�RRR�tcopytreeRgR�R�R�R5R�R�R�R�RR�RR�RRR�(
R�R�Rt	link_pathRtlink_path_hasht
download_pathR�R�t	from_path((s=/opt/alt/python33/lib/python3.3/site-packages/pip/download.pyR RsB
		


	
(RRtemail.utilsR�R�RVR�R�R,treR�R/RR9tpip.backwardcompatRRRtpip.exceptionsRRtpip.utilRRRRR	R
RRR
tpip.vcsRtpip.logRtpip._vendorRRtpip._vendor.requests.adaptersRtpip._vendor.requests.authRRtpip._vendor.requests.compatRtpip._vendor.requests.exceptionsRRtpip._vendor.requests.modelsRtpip._vendor.requests.structuresRt__all__R?R@RyRhR|tSessionR�RLRtcompiletIR�R�RRt	_drive_reR�RRR{RR�R!R"R�R�R�R�R#R (((s=/opt/alt/python33/lib/python3.3/site-packages/pip/download.pyt<module>sh@		"M#,				
						<	y

Zerion Mini Shell 1.0