Hacked By AnonymousFox

Current Path : /lib/python2.7/site-packages/pip/
Upload File :
Current File : //lib/python2.7/site-packages/pip/download.pyc

�
��abc
@@s�ddlmZddlZddlZddlZddlZddlZddlZddl	Z	ddl
Z
ddlZddlZddl
Z
ddlZyddlZeZWnek
r�eZnXddlmZddlmZddlZddlmZmZddlmZddlm Z m!Z!m"Z"m#Z#m$Z$m%Z%m&Z&m'Z'm(Z(m)Z)ddl*m+Z+dd	l,m-Z-dd
l.m/Z/ddl0m1Z1ddl2m3Z3dd
l4m5Z5m6Z6ddl7m8Z8ddl9m:Z:ddl;m<Z<m=Z=ddl>m?Z?m@Z@ddlAmBZBmCZCddlDmEZEmFZFddlGmHZHddlImJZJddl;mKZKddlLmMZMddlNmOZOddlPmQZQddlRmSZSdddddd d!d"d#d$d%d&d'g
ZTejUeV�ZWd(�ZXd)eBfd*��YZYd+e?fd,��YZZd-eOfd.��YZ[d/e@fd0��YZ\d1e<j]fd2��YZ^ddd3�Z`ejad4ejb�Zcejad5ejb�Zdd6�Zed7�Zfd8�Zgd9�Zhd:�Zid;�Zjd<�Zkd=�Zld>�Zmd?�Znd@�ZodA�ZpddddB�ZqdddC�ZrdD�ZsdEeSjtfdF��YZudedddG�ZvdH�ZwdI�ZxdJ�ZydK�ZzdS(Li(tabsolute_importN(tparse(trequest(tInstallationErrortHashMismatch(tPyPI(
tsplitexttrmtreetformat_sizetdisplay_patht
backup_dirtask_path_existstunpack_filetARCHIVE_EXTENSIONStconsumetcall_subprocess(tauto_decode(tcheck_path_owner(t
indent_log(tSETUPTOOLS_SHIM(tlibc_ver(tDownloadProgressBartDownloadProgressSpinner(twrite_delete_marker_file(tvcs(trequeststsix(tBaseAdaptertHTTPAdapter(tAuthBaset
HTTPBasicAuth(tCONTENT_CHUNK_SIZEtResponse(tget_netrc_auth(tCaseInsensitiveDict(turllib3(tCacheControlAdapter(t	FileCache(t	LockError(t
xmlrpc_clienttget_file_contenttis_urlturl_to_pathtpath_to_urltis_archive_filetunpack_vcs_linktunpack_file_urlt
is_vcs_urltis_file_urltunpack_http_urlt
unpack_urltparse_content_dispositiontsanitize_content_filenamec
C@s�iidd6tjd6d6tj�d6itj�d6d6}|dddkrjtj�|dd<n�|dddkr�tjjd	kr�tjd
 }n	tj}djg|D]}t	|�^q��|dd<nV|dddkrtj�|dd<n+|ddd
kr2tj�|dd<ntjj
d�r�ddlm}t
td�tdddg|j����}t
td�tddgt����}|r�||d<n|r�||d<q�ntjj
d�rtj�dridd6tj�dd6|d<ntj�rItj�|jdi�d<ntj�rttj�|jdi�d<ntj�r�tj�|d<ntr�tjd d&kr�tj|d<ndjd |d!tj|d"d'd%t��S((s6
    Return a string representing the user agent.
    tpiptnametversiont	installertpythontimplementationtCPythontPyPytfinalit.tJythont
IronPythontlinuxi(tdistrocS@s|dS(Ni((tx((s0/usr/lib/python2.7/site-packages/pip/download.pyt<lambda>`ttidcS@s|dS(Ni((RC((s0/usr/lib/python2.7/site-packages/pip/download.pyRDdREtlibtlibcRBtdarwintmacOStsystemtreleasetcpuiitopenssl_versions9{data[installer][name]}/{data[installer][version]} {json}tdatatjsont
separatorst,t:t	sort_keys(ii(RRRS(R5t__version__tplatformtpython_versiontpython_implementationtsystpypy_version_infotreleaseleveltjointstrt
startswithtpip._vendorRBtdicttfiltertziptlinux_distributionRtmac_verRKt
setdefaultRLtmachinetHAS_TLStversion_infotssltOPENSSL_VERSIONtformatRPtdumpstTrue(RORZRCRBtdistro_infosRH((s0/usr/lib/python2.7/site-packages/pip/download.pyt
user_agent@sT
	-$
"%	tMultiDomainBasicAuthcB@s/eZed�Zd�Zd�Zd�ZRS(cC@s||_i|_dS(N(t	promptingt	passwords(tselfRq((s0/usr/lib/python2.7/site-packages/pip/download.pyt__init__�s	cC@s.tj|j�}|jjdd�d}tj|d |f|d�|_|jj|d�\}}|dkr�|j	|j�\}}n|dkr�|dkr�t
|j�}|r�|nd\}}n|s�|r||f|j|<t|p�d|pd�|�}n|jd|j
�|S(	Nt@ii����iREtresponse(NN(NN(turllib_parseturlparseturltnetloctrsplitt
urlunparseRrtgettNonetparse_credentialsR!Rt
register_hookt
handle_401(RstreqtparsedRztusernametpasswordt
netrc_auth((s0/usr/lib/python2.7/site-packages/pip/download.pyt__call__�s%$cK@s�|jdkr|S|js |Stj|j�}tjjd|j�}t	j	d�}|sf|r||f|j
|j<n|j|jj
�t|p�d|p�d�|j�}|jj||�}|jj|�|S(Ni�s
User for %s: s
Password: RE(tstatus_codeRqRwRxRyRtmovestinputRztgetpassRrtcontenttrawtrelease_connRRt
connectiontsendthistorytappend(RstresptkwargsR�R�R�R�tnew_resp((s0/usr/lib/python2.7/site-packages/pip/download.pyR��s	
$cC@sLd|krH|jdd�d}d|kr>|jdd�S|dfSdS(NRuiiRS(NN(R{tsplitR~(RsRztuserinfo((s0/usr/lib/python2.7/site-packages/pip/download.pyR�s
(t__name__t
__module__RmRtR�R�R(((s0/usr/lib/python2.7/site-packages/pip/download.pyRp�s	!	"tLocalFSAdaptercB@s)eZdddddd�Zd�ZRS(c
C@s�t|j�}t�}d|_|j|_ytj|�}	Wn%tk
rg}
d|_|
|_n}Xtj	j
|	jdt�}t
j|�dp�d}ti|d6|	jd6|d6�|_t|d	�|_|jj|_|S(
Ni�i�tusegmtis
text/plainsContent-TypesContent-Lengths
Last-Modifiedtrb(R*RyR R�toststattOSErrorR�temailtutilst
formatdatetst_mtimeRmt	mimetypest
guess_typeR"tst_sizetheaderstopentclose(
RsRtstreamttimeouttverifytcerttproxiestpathnameR�tstatstexctmodifiedtcontent_type((s0/usr/lib/python2.7/site-packages/pip/download.pyR��s$			

cC@sdS(N((Rs((s0/usr/lib/python2.7/site-packages/pip/download.pyR��sN(R�R�R~R�R�(((s0/usr/lib/python2.7/site-packages/pip/download.pyR��st
SafeFileCachecB@s2eZdZd�Zd�Zd�Zd�ZRS(sw
    A file based cache which is safe to use even when the target directory may
    not be accessible or writable.
    cO@sKtt|�j||�t|j�sGtjd|j�d|_ndS(Ns�The directory '%s' or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.(tsuperR�RtRt	directorytloggertwarningR~(RstargsR�((s0/usr/lib/python2.7/site-packages/pip/download.pyRt�s
cO@sQ|jdkrdSytt|�j||�SWntttfk
rLnXdS(N(R�R~R�R�R}R&R�tIOError(RsR�R�((s0/usr/lib/python2.7/site-packages/pip/download.pyR}scO@sQ|jdkrdSytt|�j||�SWntttfk
rLnXdS(N(R�R~R�R�tsetR&R�R�(RsR�R�((s0/usr/lib/python2.7/site-packages/pip/download.pyR�scO@sQ|jdkrdSytt|�j||�SWntttfk
rLnXdS(N(R�R~R�R�tdeleteR&R�R�(RsR�R�((s0/usr/lib/python2.7/site-packages/pip/download.pyR�)s(R�R�t__doc__RtR}R�R�(((s0/usr/lib/python2.7/site-packages/pip/download.pyR��s
		
	
tInsecureHTTPAdaptercB@seZd�ZRS(cC@sd|_d|_dS(Nt	CERT_NONE(t	cert_reqsR~tca_certs(RstconnRyR�R�((s0/usr/lib/python2.7/site-packages/pip/download.pytcert_verify9s	(R�R�R�(((s0/usr/lib/python2.7/site-packages/pip/download.pyR�7st
PipSessioncB@s eZdZd�Zd�ZRS(c	O@s5|jdd�}|jdd�}|jdg�}tt|�j||�t�|jd<t�|_t	j
d|ddgd	d
�}|r�tdt|dt
�d|�}ntd|�}td|�}|jd
|�|jd|�|jdt��x'|D]}|jdj|�|�qWdS(Ntretriesitcachetinsecure_hostss
User-Agentttotaltstatus_forcelisti�tbackoff_factorg�?tuse_dir_locktmax_retriesshttps://shttp://sfile://shttps://{0}/(tpopR~R�R�RtRoR�RptauthR#tRetryR$R�RmRR�tmountR�Rk(	RsR�R�R�R�R�tsecure_adaptertinsecure_adapterthost((s0/usr/lib/python2.7/site-packages/pip/download.pyRtBs*			
cO@s2|jd|j�tt|�j||||�S(NR�(ReR�R�R�R(RstmethodRyR�R�((s0/usr/lib/python2.7/site-packages/pip/download.pyR~sN(R�R�R~R�RtR(((s0/usr/lib/python2.7/site-packages/pip/download.pyR�>s	<c
C@s�|dkrtd��ntj|�}|r[|jd�j�}|dkr|r|jd�rtd||f��n|dkr/|jdd�d}|j	dd�}t
j|�}|r�|jd�d|jd	d�d}ntj
|�}|jd�r&d|jd�}n|}q[|j|�}|j�|j|jfSny.t|d
��}t|j��}WdQXWn)tk
r�}	tdt|	���nX||fS(
s�Gets the content of a file; it may be a filename, file: URL, or
    http: URL.  Returns (location, content).  Content is unicode.sAget_file_content() missing 1 required keyword argument: 'session'itfilethttps6Requirements file %s references URL %s, which is localRSs\t/t|R�Ns$Could not open requirements file: %s(R~t	TypeErrort
_scheme_retsearchtgrouptlowerR^RR�treplacet_url_slash_drive_retmatchRwtunquotetlstripR}traise_for_statusRyttextR�RtreadR�R](
Ryt
comes_fromtsessionR�tschemetpathR�tfR�R�((s0/usr/lib/python2.7/site-packages/pip/download.pyR(�s>*	
s^(http|https|file):s/*([a-z])\|cC@sId|krtS|jdd�dj�}|ddddgtjkS(s)Returns true if the name looks like a URLRSiiR�thttpsR�tftp(tFalseR�R�Rtall_schemes(R6R�((s0/usr/lib/python2.7/site-packages/pip/download.pyR)�scC@sg|jd�std|��tj|�\}}}}}|rPd|}ntj||�}|S(s(
    Convert a file: URL to a path.
    sfile:s4You can only turn file: urls into filenames (not %r)s\\(R^tAssertionErrorRwturlsplitturllib_requestturl2pathname(Ryt_RzR�((s0/usr/lib/python2.7/site-packages/pip/download.pyR*�s

cC@s=tjjtjj|��}tjdtj|��}|S(sh
    Convert a path to a file: URL.  The path will be made absolute and have
    quoted path parts.
    sfile:(R�R�tnormpathtabspathRwturljoinR�tpathname2url(R�Ry((s0/usr/lib/python2.7/site-packages/pip/download.pyR+�scC@s*t|�dj�}|tkr&tStS(s9Return True if `name` is a considered as an archive file.i(RR�R
RmR�(R6text((s0/usr/lib/python2.7/site-packages/pip/download.pyR,�scC@st|�}|j|�dS(N(t_get_used_vcs_backendtunpack(tlinktlocationtvcs_backend((s0/usr/lib/python2.7/site-packages/pip/download.pyR-�scC@s=x6tjD]+}|j|jkr
||j�}|Sq
WdS(N(RtbackendsR�tschemesRy(R�tbackendR�((s0/usr/lib/python2.7/site-packages/pip/download.pyR��scC@stt|��S(N(tboolR�(R�((s0/usr/lib/python2.7/site-packages/pip/download.pyR/�scC@s|jj�jd�S(Nsfile:(RyR�R^(R�((s0/usr/lib/python2.7/site-packages/pip/download.pyR0�scC@st|j�}tjj|�S(s�Return whether a file:// Link points to a directory.

    ``link`` must not have any other scheme but file://. Call is_file_url()
    first.

    (R*turl_without_fragmentR�R�tisdir(R�t	link_path((s0/usr/lib/python2.7/site-packages/pip/download.pyt
is_dir_url�scO@s|S(N((titerableR�R�((s0/usr/lib/python2.7/site-packages/pip/download.pyt_progress_indicator�sc
@s�yt�jd�}Wn tttfk
r9d}nXt�dt�}tj�t	j
krjt}n9|ryt}n*|d
kr�t}n|s�t}nt}|j}�fd�}�fd�}	t
}
|jtjkr�|}n	|j}|rM|r.tjd|t|��td	|�j}
qvtjd
|�t�j}
n)|rftjd|�ntjd
|�tjd|�|	|
|t�t��}|r�|j|�n
t|�dS(Nscontent-lengthit
from_cachei(i�c3@sry,x%�jj|dt�D]}|VqWWn?tk
rmx/tri�jj|�}|saPn|Vq?WnXdS(Ntdecode_content(R�R�R�tAttributeErrorRmR�(t
chunk_sizetchunk(R�(s0/usr/lib/python2.7/site-packages/pip/download.pyt	resp_reads


	c3@s'x |D]}�j|�|VqWdS(N(twrite(tchunksR(tcontent_file(s0/usr/lib/python2.7/site-packages/pip/download.pytwritten_chunks;s

sDownloading %s (%s)tmaxsDownloading %ssUsing cached %ssDownloading from URL %si@�(tintR�t
ValueErrortKeyErrorR�tgetattrR�R�tgetEffectiveLeveltloggingtINFORmtshow_urlRRzRRtinfoRRtiterRtdebugRtcheck_against_chunksR(
R�R�Rthashesttotal_lengthtcached_respt
show_progressRR
Rtprogress_indicatorRytdownloaded_chunks((RR�s0/usr/lib/python2.7/site-packages/pip/download.pyt
_download_urlsL
					%			cC@s,t}tjj||j�}tjj|�r�tdt|�d
�}|dkr^t}q�|dkr�t	j
dt|��tj|�q�|dkr�t|�}t	j
dt|�t|��t
j||�q�|dkr�tjd�q�n|r(t
j||�t	jd	t|��ndS(Ns8The file %s exists. (i)gnore, (w)ipe, (b)ackup, (a)aborttitwtbtasDeleting %ssBacking up %s to %si����sSaved %s(R&R'R(R)(RmR�R�R\tfilenametexistsRR	R�R�R�tremoveR
tshutiltmoveRYtexittcopyR(R*R�R�R0tdownload_locationRvt	dest_file((s0/usr/lib/python2.7/site-packages/pip/download.pyt
_copy_fileas.		
c	C@s�|dkrtd��ntjdd�}d}|rNt|||�}n|rp|}tj|�d}nt||||�\}}t||||�|r�|r�t	|||�n|s�t
j|�nt|�dS(Ns@unpack_http_url() missing 1 required keyword argument: 'session's-unpackspip-i(
R~R�ttempfiletmkdtempt_check_download_dirR�R�t_download_http_urlRR3R�tunlinkR(	R�R�tdownload_dirR�Rttemp_dirtalready_downloaded_patht	from_pathR�((s0/usr/lib/python2.7/site-packages/pip/download.pyR1|s,
cC@st|j�}t|�rjtjj|�r:t|�ntj||dt	�|rft
jd�ndS|r�|j|�nd}|r�t|||�}n|r�|}n|}tj|�d}t||||�|r�|r�t|||�ndS(s�Unpack link into location.

    If download_dir is provided and link points to a file, make a copy
    of the link file inside download_dir.
    tsymlinkss*Link is a directory, ignoring download_dirNi(R*RRR�R�RRR-tcopytreeRmR�Rtcheck_against_pathR~R6R�R�RR3(R�R�R9RRR;R<R�((s0/usr/lib/python2.7/site-packages/pip/download.pyR.�s,
	
c
C@s�tjj|�rt|�nd}tjg}|jd�|jt|�|jd�|d|g7}tj	d|�t
��t|d|dt�WdQXtjj
|tj|�d	�}tj	d
||�t||dddd�dS(
s�Copy distribution files in `link_path` to `location`.

    Invoked when user requests to install a local directory. E.g.:

        pip install .
        pip install ~/dev/git-repos/python-prompt-toolkit

    ssetup.pys-ctsdists
--dist-dirsRunning setup.py sdist for %stcwdtshow_stdoutNisUnpacking sdist %s into %sR�R�(R�R�RRRYt
executableR�RR�RRRR�R\tlistdirRR~(RR�tsetup_pyt
sdist_argsR@((s0/usr/lib/python2.7/site-packages/pip/download.pyt_copy_dist_from_dir�s



"tPipXmlrpcTransportcB@s&eZdZed�Zed�ZRS(sRProvide a `xmlrpclib.Transport` implementation via a `PipSession`
    object.
    cC@s;tjj||�tj|�}|j|_||_dS(N(R't	TransportRtRwRxR�t_schemet_session(Rst	index_urlR�tuse_datetimetindex_parts((s0/usr/lib/python2.7/site-packages/pip/download.pyRt�sc
C@s�|j||dddf}tj|�}yXidd6}|jj|d|d|dt�}|j�||_|j	|j
�SWn2tjk
r�}	t
jd|	jj|��nXdS(Nstext/xmlsContent-TypeROR�R�sHTTP error %s while getting %s(RJR~RwR|RKtpostRmR�tverbosetparse_responseR�Rt	HTTPErrorR�tcriticalRvR�(
RsR�thandlertrequest_bodyRPtpartsRyR�RvR�((s0/usr/lib/python2.7/site-packages/pip/download.pyRs

	(R�R�R�R�RtR(((s0/usr/lib/python2.7/site-packages/pip/download.pyRH�scC@s�t|�rt||�nVt|�rAt|||d|�n1|dkrYt�}nt||||d|�|r�t|�ndS(svUnpack link.
       If link is a VCS link:
         if only_download, export into download_dir and ignore location
          else unpack into location
       for other types of link:
         - unpack into location
         - if download_dir, copy the file into download_dir
         - if only_download, mark location for deletion

    :param hashes: A Hashes object, one of whose embedded hashes must match,
        or HashMismatch will be raised. If the Hashes is empty, no matches are
        required, and unhashable types of requirements (like VCS ones, which
        would ordinarily raise HashUnsupported) are allowed.
    RN(R/R-R0R.R~R�R1R(R�R�R9t
only_downloadR�R((s0/usr/lib/python2.7/site-packages/pip/download.pyR2scC@stjj|�S(sJ
    Sanitize the "filename" value from a Content-Disposition header.
    (R�R�tbasename(R*((s0/usr/lib/python2.7/site-packages/pip/download.pyR4<scC@sCtj|�\}}|jd�}|r9t|�}n|pB|S(s�
    Parse the "filename" value from a Content-Disposition header, and
    return the default filename if the result is empty.
    R*(tcgitparse_headerR}R4(tcontent_dispositiontdefault_filenamet_typetparamsR*((s0/usr/lib/python2.7/site-packages/pip/download.pyR3Ds
c
	C@s�|jjdd�d}y0|j|didd6dt�}|j�Wn2tjk
r}}tjd|j	j
|��nX|jjd	d
�}|j}|jjd�}	|	r�t
|	|�}nt|�d}
|
stj|�}
|
r||
7}qn|
rI|j|jkrItjj|j�d}
|
rI||
7}qIntjj||�}t|d��}t||||�Wd
QX||fS(s6Download link url into temp_dir using provided sessiont#iiR�tidentitysAccept-EncodingR�sHTTP error %s while getting %sscontent-typeREscontent-dispositiontwbN(RyR�R}RmR�RRRR�RSRvR�R�R*R3RR�tguess_extensionR�R�R\R�R%(
R�R�R:Rt
target_urlR�R�R�R*R[R�t	file_pathR((s0/usr/lib/python2.7/site-packages/pip/download.pyR7Ss:
		cC@s�tjj||j�}tjj|�r�tjd|�|r�y|j|�Wq�tk
r�tj	d|�tj
|�dSXn|SdS(s� Check download_dir for previously downloaded file with correct hash
        If a correct file is found return its path else None
    sFile was already downloaded %ss;Previously-downloaded file %s has bad hash. Re-downloading.N(R�R�R\R*R+R�RR?RR�R8R~(R�R9Rt
download_path((s0/usr/lib/python2.7/site-packages/pip/download.pyR6�s

({t
__future__RRYtemail.utilsR�R�RPRR�R�RVtreR-RYR4RiRmRgtImportErrorR�tpip._vendor.six.moves.urllibRRwRR�R5tpip.exceptionsRRt
pip.modelsRt	pip.utilsRRRR	R
RRR
RRtpip.utils.encodingRtpip.utils.filesystemRtpip.utils.loggingRtpip.utils.setuptools_buildRtpip.utils.glibcRtpip.utils.uiRRt
pip.locationsRtpip.vcsRR_RRtpip._vendor.requests.adaptersRRtpip._vendor.requests.authRRtpip._vendor.requests.modelsRR tpip._vendor.requests.utilsR!tpip._vendor.requests.structuresR"R#tpip._vendor.cachecontrolR$tpip._vendor.cachecontrol.cachesR%tpip._vendor.lockfileR&tpip._vendor.six.movesR't__all__t	getLoggerR�R�RoRpR�R�R�tSessionR�R~R(tcompiletIR�R�R)R*R+R,R-R�R/R0RRR%R3R1R.RGRIRHR2R4R3R7R6(((s0/usr/lib/python2.7/site-packages/pip/download.pyt<module>s�


F			BR!BH)			
								`	&0	$'			8

Hacked By AnonymousFox1.0, Coded By AnonymousFox