� ��abc @@s�ddlmZddlZddlZddlZddlZddlZddlZddl Z ddl Z ddl Z ddl 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/dd l0m1Z1dd 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`e jad4e jb�Zce jad5e jb�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( tsplitexttrmtreet format_sizet display_patht backup_dirtask_path_existst unpack_filetARCHIVE_EXTENSIONStconsumetcall_subprocess(t auto_decode(tcheck_path_owner(t indent_log(tSETUPTOOLS_SHIM(tlibc_ver(tDownloadProgressBartDownloadProgressSpinner(twrite_delete_marker_file(tvcs(trequeststsix(t BaseAdaptert HTTPAdapter(tAuthBaset HTTPBasicAuth(tCONTENT_CHUNK_SIZEtResponse(tget_netrc_auth(tCaseInsensitiveDict(turllib3(tCacheControlAdapter(t FileCache(t LockError(t xmlrpc_clienttget_file_contenttis_urlt url_to_patht path_to_urltis_archive_filetunpack_vcs_linktunpack_file_urlt is_vcs_urlt is_file_urltunpack_http_urlt unpack_urltparse_content_dispositiontsanitize_content_filenamec C@s�iidd6tjd6d6tj�d6itj�d6d6}|dddkrjtj�|dd`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 startswitht pip._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||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 | j dt �} 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.pyt cert_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�|jds    *  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�Rt all_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(tlinktlocationt vcs_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_lengtht cached_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)aborttitwtbtas Deleting %ssBacking up %s to %si����sSaved %s(R&R'R(R)(RmR�R�R\tfilenametexistsR R 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 j d�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||d dd 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 %stcwdt show_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_datetimet index_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 �SWn2t j 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|j jd d �}|j }|j jd �} | 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__RRYt email.utilsR�R�RPRR�R�RVtreR-RYR4RiRmRgt ImportErrorR�tpip._vendor.six.moves.urllibRRwRR�R5tpip.exceptionsRRt pip.modelsRt pip.utilsRRRR R R R 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.pyts�                 F    BR!BH)         ` &0 $'   8