
Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­
<!DOCTYPE html>
<html>
ó
•�abc           @@  s‘  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	 Z	 d  d l
 Z
 d  d l Z d  d l Z d  d l Z d  d l Z y d  d l Z e Z Wn e k
 rÏ e Z n Xd  d l m Z d  d l m Z d  d l Z d  d l m Z m Z d  d l m Z d  d l m  Z  m! Z! m" Z" m# Z# m$ Z$ m% Z% m& Z& m' Z' m( Z( m) Z) d  d l* m+ Z+ d  d	 l, m- Z- d  d
 l. m/ Z/ d  d l0 m1 Z1 d  d l2 m3 Z3 d  d l4 m5 Z5 m6 Z6 d  d l7 m8 Z8 d  d l9 m: Z: d  d l; m< Z< m= Z= d  d l> m? Z? m@ Z@ d  d lA mB ZB mC ZC d  d lD mE ZE mF ZF d  d lG mH ZH d  d lI mJ ZJ d  d l; mK ZK d  d lL mM ZM d  d lN mO ZO d  d lP mQ ZQ d  d lR mS ZS d d d d d d  d! d" d# d$ d% d& d' g ZT e jU eV ƒ ZW d( „  ZX d) eB f d* „  ƒ  YZY d+ e? f d, „  ƒ  YZZ d- eO f d. „  ƒ  YZ[ d/ e@ f d0 „  ƒ  YZ\ d1 e< j] f d2 „  ƒ  YZ^ d d d3 „ Z` e ja d4 e jb ƒ Zc e ja d5 e jb ƒ Zd d6 „  Ze d7 „  Zf d8 „  Zg d9 „  Zh d: „  Zi d; „  Zj d< „  Zk d= „  Zl d> „  Zm d? „  Zn d@ „  Zo dA „  Zp d d d dB „ Zq d d dC „ Zr dD „  Zs dE eS jt f dF „  ƒ  YZu d e d d dG „ Zv dH „  Zw dI „  Zx dJ „  Zy dK „  Zz d S(L   i    (   t   absolute_importN(   t   parse(   t   request(   t   InstallationErrort   HashMismatch(   t   PyPI(
   t   splitextt   rmtreet   format_sizet   display_patht
   backup_dirt   ask_path_existst   unpack_filet   ARCHIVE_EXTENSIONSt   consumet   call_subprocess(   t   auto_decode(   t   check_path_owner(   t
   indent_log(   t   SETUPTOOLS_SHIM(   t   libc_ver(   t   DownloadProgressBart   DownloadProgressSpinner(   t   write_delete_marker_file(   t   vcs(   t   requestst   six(   t   BaseAdaptert   HTTPAdapter(   t   AuthBaset   HTTPBasicAuth(   t   CONTENT_CHUNK_SIZEt   Response(   t   get_netrc_auth(   t   CaseInsensitiveDict(   t   urllib3(   t   CacheControlAdapter(   t	   FileCache(   t	   LockError(   t   xmlrpc_clientt   get_file_contentt   is_urlt   url_to_patht   path_to_urlt   is_archive_filet   unpack_vcs_linkt   unpack_file_urlt
   is_vcs_urlt   is_file_urlt   unpack_http_urlt
   unpack_urlt   parse_content_dispositiont   sanitize_content_filenamec       
   C@  sç  i i d d 6t  j d 6d 6t j ƒ  d 6i t j ƒ  d 6d 6}  |  d d d k rj t j ƒ  |  d d <nÈ |  d d d k rÜ t j j d	 k r  t j d
  } n	 t j } d j g  | D] } t	 | ƒ ^ q¶ ƒ |  d d <nV |  d d d k rt j ƒ  |  d d <n+ |  d d d k r2t j ƒ  |  d d <n  t j j
 d ƒ r×d d l m } t t d „  t d d d g | j ƒ  ƒ ƒ ƒ } t t d „  t d d g t ƒ  ƒ ƒ ƒ } | rÁ| | d <n  | r×| |  d <q×n  t j j
 d ƒ rt j ƒ  d ri d d 6t j ƒ  d d 6|  d <n  t j ƒ  rIt j ƒ  |  j d i  ƒ d <n  t j ƒ  rtt j ƒ  |  j d i  ƒ d <n  t j ƒ  r“t j ƒ  |  d <n  t r¼t j d  d& k r¼t j |  d <n  d j d  |  d! t j |  d" d' d% t ƒƒ S((   s6   
    Return a string representing the user agent.
    t   pipt   namet   versiont	   installert   pythont   implementationt   CPythont   PyPyt   finali   t   .t   Jythont
   IronPythont   linuxi    (   t   distroc         S@  s   |  d S(   Ni   (    (   t   x(    (    s0   /usr/lib/python2.7/site-packages/pip/download.pyt   <lambda>`   t    t   idc         S@  s   |  d S(   Ni   (    (   RC   (    (    s0   /usr/lib/python2.7/site-packages/pip/download.pyRD   d   RE   t   libt   libcRB   t   darwint   macOSt   systemt   releaset   cpui   i   t   openssl_versions9   {data[installer][name]}/{data[installer][version]} {json}t   datat   jsont
   separatorst   ,t   :t	   sort_keys(   i   i   (   RR   RS   (   R5   t   __version__t   platformt   python_versiont   python_implementationt   syst   pypy_version_infot   releaselevelt   joint   strt
   startswitht   pip._vendorRB   t   dictt   filtert   zipt   linux_distributionR   t   mac_verRK   t
   setdefaultRL   t   machinet   HAS_TLSt   version_infot   sslt   OPENSSL_VERSIONt   formatRP   t   dumpst   True(   RO   RZ   RC   RB   t   distro_infosRH   (    (    s0   /usr/lib/python2.7/site-packages/pip/download.pyt
   user_agent@   sT    	-$"%	t   MultiDomainBasicAuthc           B@  s/   e  Z e d  „ Z d „  Z d „  Z d „  Z RS(   c         C@  s   | |  _  i  |  _ d  S(   N(   t	   promptingt	   passwords(   t   selfRq   (    (    s0   /usr/lib/python2.7/site-packages/pip/download.pyt   __init__„   s    	c         C@  s.  t  j | j ƒ } | j j d d ƒ d } t  j | d  | f | d ƒ | _ |  j j | d ƒ \ } } | d  k r’ |  j	 | j ƒ \ } } n  | d  k rÔ | d  k rÔ t
 | j ƒ } | rÅ | n d \ } } n  | sà | r| | f |  j | <t | pÿ d | pd ƒ | ƒ } n  | j d |  j ƒ | S(	   Nt   @i   iÿÿÿÿi   RE   t   response(   NN(   NN(   t   urllib_parset   urlparset   urlt   netloct   rsplitt
   urlunparseRr   t   gett   Nonet   parse_credentialsR!   R   t   register_hookt
   handle_401(   Rs   t   reqt   parsedRz   t   usernamet   passwordt
   netrc_auth(    (    s0   /usr/lib/python2.7/site-packages/pip/download.pyt   __call__ˆ   s    %$c         K@  sà   | j  d k r | S|  j s  | St j | j ƒ } t j j d | j ƒ } t	 j	 d ƒ } | sf | r | | f |  j
 | j <n  | j | j j ƒ  t | pŸ d | p¨ d ƒ | j ƒ } | j j | | � } | j j | ƒ | S(   Ni‘  s   User for %s: s
   Password: RE   (   t   status_codeRq   Rw   Rx   Ry   R   t   movest   inputRz   t   getpassRr   t   contentt   rawt   release_connR   R   t
   connectiont   sendt   historyt   append(   Rs   t   respt   kwargsRƒ   R„   R…   R‚   t   new_resp(    (    s0   /usr/lib/python2.7/site-packages/pip/download.pyR�   ©   s    	$c         C@  sL   d | k rH | j  d d ƒ d } d | k r> | j d d ƒ S| d  f Sd S(   NRu   i   i    RS   (   NN(   R{   t   splitR~   (   Rs   Rz   t   userinfo(    (    s0   /usr/lib/python2.7/site-packages/pip/download.pyR   Ë   s    
(   t   __name__t
   __module__Rm   Rt   R‡   R�   R   (    (    (    s0   /usr/lib/python2.7/site-packages/pip/download.pyRp   ‚   s   	!	"t   LocalFSAdapterc           B@  s)   e  Z d d d d d d  „ Z d „  Z RS(   c         C@  sè   t  | j ƒ } t ƒ  } d | _ | j | _ y t j | ƒ }	 Wn% t k
 rg }
 d | _ |
 | _ n} Xt j	 j
 |	 j d t ƒ} t j | ƒ d p™ d } t i | d 6|	 j d 6| d 6ƒ | _ t | d	 ƒ | _ | j j | _ | S(
   NiÈ   i”  t   usegmti    s
   text/plains   Content-Types   Content-Lengths   Last-Modifiedt   rb(   R*   Ry   R    Rˆ   t   ost   statt   OSErrorR�   t   emailt   utilst
   formatdatet   st_mtimeRm   t	   mimetypest
   guess_typeR"   t   st_sizet   headerst   opent   close(   Rs   R   t   streamt   timeoutt   verifyt   certt   proxiest   pathnameR“   t   statst   exct   modifiedt   content_type(    (    s0   /usr/lib/python2.7/site-packages/pip/download.pyR�   Ö   s$    			
c         C@  s   d  S(   N(    (   Rs   (    (    s0   /usr/lib/python2.7/site-packages/pip/download.pyR©   ñ   s    N(   R˜   R™   R~   R�   R©   (    (    (    s0   /usr/lib/python2.7/site-packages/pip/download.pyRš   Ô   s   t   SafeFileCachec           B@  s2   e  Z d  Z d „  Z d „  Z d „  Z d „  Z RS(   sw   
    A file based cache which is safe to use even when the target directory may
    not be accessible or writable.
    c         O@  sK   t  t |  ƒ j | | Ž  t |  j ƒ sG t j d |  j ƒ d  |  _ n  d  S(   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.(   t   superR´   Rt   R   t	   directoryt   loggert   warningR~   (   Rs   t   argsR”   (    (    s0   /usr/lib/python2.7/site-packages/pip/download.pyRt   û   s    
c         O@  sQ   |  j  d  k r d  Sy t t |  ƒ j | | Ž  SWn t t t f k
 rL n Xd  S(   N(   R¶   R~   Rµ   R´   R}   R&   RŸ   t   IOError(   Rs   R¹   R”   (    (    s0   /usr/lib/python2.7/site-packages/pip/download.pyR}     s    c         O@  sQ   |  j  d  k r d  Sy t t |  ƒ j | | Ž  SWn t t t f k
 rL n Xd  S(   N(   R¶   R~   Rµ   R´   t   setR&   RŸ   Rº   (   Rs   R¹   R”   (    (    s0   /usr/lib/python2.7/site-packages/pip/download.pyR»     s    c         O@  sQ   |  j  d  k r d  Sy t t |  ƒ j | | Ž  SWn t t t f k
 rL n Xd  S(   N(   R¶   R~   Rµ   R´   t   deleteR&   RŸ   Rº   (   Rs   R¹   R”   (    (    s0   /usr/lib/python2.7/site-packages/pip/download.pyR¼   )  s    (   R˜   R™   t   __doc__Rt   R}   R»   R¼   (    (    (    s0   /usr/lib/python2.7/site-packages/pip/download.pyR´   õ   s
   			t   InsecureHTTPAdapterc           B@  s   e  Z d  „  Z RS(   c         C@  s   d | _  d  | _ d  S(   Nt	   CERT_NONE(   t	   cert_reqsR~   t   ca_certs(   Rs   t   connRy   R¬   R­   (    (    s0   /usr/lib/python2.7/site-packages/pip/download.pyt   cert_verify9  s    	(   R˜   R™   RÃ   (    (    (    s0   /usr/lib/python2.7/site-packages/pip/download.pyR¾   7  s   t
   PipSessionc           B@  s    e  Z d Z d  „  Z d „  Z RS(   c   	      O@  s5  | j  d d ƒ } | j  d d  ƒ } | j  d g  ƒ } t t |  ƒ j | | Ž  t ƒ  |  j d <t ƒ  |  _ t	 j
 d | d d g d	 d
 ƒ } | r¶ t d t | d t ƒd | ƒ } n t d | ƒ } t d | ƒ } |  j d | ƒ |  j d | ƒ |  j d t ƒ  ƒ x' | D] } |  j d j | ƒ | ƒ qWd  S(   Nt   retriesi    t   cachet   insecure_hostss
   User-Agentt   totalt   status_forcelisti÷  t   backoff_factorg      Ð?t   use_dir_lockt   max_retriess   https://s   http://s   file://s   https://{0}/(   t   popR~   Rµ   RÄ   Rt   Ro   R§   Rp   t   authR#   t   RetryR$   R´   Rm   R   R¾   t   mountRš   Rk   (	   Rs   R¹   R”   RÅ   RÆ   RÇ   t   secure_adaptert   insecure_adaptert   host(    (    s0   /usr/lib/python2.7/site-packages/pip/download.pyRt   B  s*    			c         O@  s2   | j  d |  j ƒ t t |  ƒ j | | | | Ž S(   NR«   (   Re   R«   Rµ   RÄ   R   (   Rs   t   methodRy   R¹   R”   (    (    s0   /usr/lib/python2.7/site-packages/pip/download.pyR   ~  s    N(   R˜   R™   R~   R«   Rt   R   (    (    (    s0   /usr/lib/python2.7/site-packages/pip/download.pyRÄ   >  s   	<c   
      C@  s¿  | d k r t d ƒ ‚ n  t j |  ƒ } | r[| j d ƒ j ƒ  } | d k r | r | j d ƒ r t d | |  f ƒ ‚ n  | d k r/|  j d d ƒ d } | j	 d d ƒ } t
 j | ƒ } | rò | j d ƒ d | j d	 d ƒ d } n  t j | ƒ } | j d ƒ r&d | j d ƒ } n  | }  q[| j |  ƒ } | j ƒ  | j | j f Sn  y. t |  d
 ƒ � } t | j ƒ  ƒ } Wd QXWn) t k
 r´}	 t d t |	 ƒ ƒ ‚ n X|  | f S(   s�   Gets the content of a file; it may be a filename, file: URL, or
    http: URL.  Returns (location, content).  Content is unicode.sA   get_file_content() missing 1 required keyword argument: 'session'i   t   filet   https6   Requirements file %s references URL %s, which is localRS   s   \t   /t   |Rœ   Ns$   Could not open requirements file: %s(   R~   t	   TypeErrort
   _scheme_ret   searcht   groupt   lowerR^   R   R–   t   replacet   _url_slash_drive_ret   matchRw   t   unquotet   lstripR}   t   raise_for_statusRy   t   textR¨   R   t   readRº   R]   (
   Ry   t
   comes_fromt   sessionRà   t   schemet   pathR“   t   fRŒ   R±   (    (    s0   /usr/lib/python2.7/site-packages/pip/download.pyR(   †  s>    *	
s   ^(http|https|file):s   /*([a-z])\|c         C@  sI   d |  k r t  S|  j d d ƒ d j ƒ  } | d d d d g t j k S(   s)   Returns true if the name looks like a URLRS   i   i    RÖ   t   httpsRÕ   t   ftp(   t   FalseR–   RÝ   R   t   all_schemes(   R6   Rè   (    (    s0   /usr/lib/python2.7/site-packages/pip/download.pyR)   ³  s    c         C@  sH   t  j |  ƒ \ } } } } } | r1 d | } n  t j | | ƒ } | S(   s(   
    Convert a file: URL to a path.
    s   \\(   Rw   t   urlsplitt   urllib_requestt   url2pathname(   Ry   t   _Rz   Ré   (    (    s0   /usr/lib/python2.7/site-packages/pip/download.pyR*   »  s
    c         C@  s=   t  j j t  j j |  ƒ ƒ }  t j d t j |  ƒ ƒ } | S(   sh   
    Convert a path to a file: URL.  The path will be made absolute and have
    quoted path parts.
    s   file:(   R�   Ré   t   normpatht   abspathRw   t   urljoinRð   t   pathname2url(   Ré   Ry   (    (    s0   /usr/lib/python2.7/site-packages/pip/download.pyR+   Ì  s    c         C@  s*   t  |  ƒ d j ƒ  } | t k r& t St S(   s9   Return True if `name` is a considered as an archive file.i   (   R   RÝ   R   Rm   Rí   (   R6   t   ext(    (    s0   /usr/lib/python2.7/site-packages/pip/download.pyR,   Ö  s    c         C@  s   t  |  ƒ } | j | ƒ d  S(   N(   t   _get_used_vcs_backendt   unpack(   t   linkt   locationt   vcs_backend(    (    s0   /usr/lib/python2.7/site-packages/pip/download.pyR-   Þ  s    c         C@  s=   x6 t  j D]+ } |  j | j k r
 | |  j ƒ } | Sq
 Wd  S(   N(   R   t   backendsRè   t   schemesRy   (   Rú   t   backendRü   (    (    s0   /usr/lib/python2.7/site-packages/pip/download.pyRø   ã  s    c         C@  s   t  t |  ƒ ƒ S(   N(   t   boolRø   (   Rú   (    (    s0   /usr/lib/python2.7/site-packages/pip/download.pyR/   ê  s    c         C@  s   |  j  j ƒ  j d ƒ S(   Ns   file:(   Ry   RÝ   R^   (   Rú   (    (    s0   /usr/lib/python2.7/site-packages/pip/download.pyR0   î  s    c         C@  s   t  |  j ƒ } t j j | ƒ 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*   t   url_without_fragmentR�   Ré   t   isdir(   Rú   t	   link_path(    (    s0   /usr/lib/python2.7/site-packages/pip/download.pyt
   is_dir_urlò  s    c         O@  s   |  S(   N(    (   t   iterableR¹   R”   (    (    s0   /usr/lib/python2.7/site-packages/pip/download.pyt   _progress_indicatorý  s    c         @  sÅ  y t  ˆ j d ƒ } Wn  t t t f k
 r9 d } n Xt ˆ d t ƒ } t j ƒ  t	 j
 k rj t } n9 | ry t } n* | d k rŽ t } n | s� t } n t } | j } ‡ f d †  } ‡  f d †  }	 t }
 | j t j k rë | } n	 | j } | rM| r.t j d | t | ƒ ƒ t d	 | ƒ j }
 qvt j d
 | ƒ t ƒ  j }
 n) | rft j d | ƒ n t j d
 | ƒ t j d | ƒ |	 |
 | t ƒ t ƒ ƒ } | r·| j | ƒ n
 t | ƒ d  S(   Ns   content-lengthi    t
   from_cachei(   iè  c         3@  sr   y, x% ˆ  j  j |  d t ƒD] } | Vq WWn? t k
 rm x/ t ri ˆ  j  j |  ƒ } | sa Pn  | Vq? Wn Xd  S(   Nt   decode_content(   R�   Rª   Rí   t   AttributeErrorRm   Rå   (   t
   chunk_sizet   chunk(   R“   (    s0   /usr/lib/python2.7/site-packages/pip/download.pyt	   resp_read  s    	c         3@  s'   x  |  D] } ˆ  j  | ƒ | Vq Wd  S(   N(   t   write(   t   chunksR  (   t   content_file(    s0   /usr/lib/python2.7/site-packages/pip/download.pyt   written_chunks;  s    s   Downloading %s (%s)t   maxs   Downloading %ss   Using cached %ss   Downloading from URL %si@œ  (   t   intR§   t
   ValueErrort   KeyErrorRÙ   t   getattrRí   R·   t   getEffectiveLevelt   loggingt   INFORm   t   show_urlR  Rz   R   R  t   infoR   R   t   iterR   t   debugR   t   check_against_chunksR   (   R“   Rú   R  t   hashest   total_lengtht   cached_respt   show_progressR  R  R  t   progress_indicatorRy   t   downloaded_chunks(    (   R  R“   s0   /usr/lib/python2.7/site-packages/pip/download.pyt   _download_url  sL    
					%			c         C@  s,  t  } t j j | | j ƒ } t j j | ƒ rù t d t | ƒ d
 ƒ } | d k r^ t } qù | d k r� t	 j
 d t | ƒ ƒ t j | ƒ qù | d k rÚ t | ƒ } t	 j
 d t | ƒ t | ƒ ƒ t j | | ƒ qù | d k rù t j d ƒ qù n  | r(t j |  | ƒ t	 j d	 t | ƒ ƒ n  d  S(   Ns8   The file %s exists. (i)gnore, (w)ipe, (b)ackup, (a)abortt   it   wt   bt   as   Deleting %ss   Backing up %s to %siÿÿÿÿs   Saved %s(   R%  R&  R'  R(  (   Rm   R�   Ré   R\   t   filenamet   existsR   R	   Rí   R·   R¸   t   removeR
   t   shutilt   moveRY   t   exitt   copyR  (   R)  Rû   Rú   R/  t   download_locationRv   t	   dest_file(    (    s0   /usr/lib/python2.7/site-packages/pip/download.pyt
   _copy_filea  s.    		c   	      C@  sâ   | d  k r t d ƒ ‚ n  t j d d ƒ } d  } | rN t |  | | ƒ } n  | rp | } t j | ƒ d } n t |  | | | ƒ \ } } t | | | |  ƒ | r¾ | r¾ t	 | | |  ƒ n  | sÔ t
 j | ƒ n  t | ƒ d  S(   Ns@   unpack_http_url() missing 1 required keyword argument: 'session's   -unpacks   pip-i    (   R~   RÙ   t   tempfilet   mkdtempt   _check_download_dirR¤   R¥   t   _download_http_urlR   R2  R�   t   unlinkR   (	   Rú   Rû   t   download_dirRç   R  t   temp_dirt   already_downloaded_patht	   from_pathR³   (    (    s0   /usr/lib/python2.7/site-packages/pip/download.pyR1   |  s,    c         C@  s   t  |  j ƒ } t |  ƒ rj t j j | ƒ r: t | ƒ n  t j | | d t	 ƒ| rf t
 j d ƒ n  d S| r€ | j | ƒ n  d } | r¡ t |  | | ƒ } n  | r° | } n | } t j | ƒ d } t | | | |  ƒ | rü | rü t | | |  ƒ n  d S(   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.
    t   symlinkss*   Link is a directory, ignoring download_dirNi    (   R*   R  R  R�   Ré   R  R   R,  t   copytreeRm   R·   R  t   check_against_pathR~   R5  R¤   R¥   R   R2  (   Rú   Rû   R8  R  R  R:  R;  R³   (    (    s0   /usr/lib/python2.7/site-packages/pip/download.pyR.   £  s,    	c      
   C@  sô   t  j j | ƒ r t | ƒ n  d } t j g } | j d ƒ | j t | ƒ | j d ƒ | d | g 7} t j	 d |  ƒ t
 ƒ  � t | d |  d t ƒWd QXt  j j | t  j | ƒ d	 ƒ } t j	 d
 | | ƒ t | | d d d d ƒd S(   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

    s   setup.pys   -ct   sdists
   --dist-dirs   Running setup.py sdist for %st   cwdt   show_stdoutNi    s   Unpacking sdist %s into %sR³   Rú   (   R�   Ré   R  R   RY   t
   executableR’   R   R·   R  R   R   Rí   R\   t   listdirR   R~   (   R  Rû   t   setup_pyt
   sdist_argsR?  (    (    s0   /usr/lib/python2.7/site-packages/pip/download.pyt   _copy_dist_from_dirÓ  s    
"t   PipXmlrpcTransportc           B@  s&   e  Z d  Z e d „ Z e d „ Z RS(   sR   Provide a `xmlrpclib.Transport` implementation via a `PipSession`
    object.
    c         C@  s;   t  j j |  | ƒ t j | ƒ } | j |  _ | |  _ d  S(   N(   R'   t	   TransportRt   Rw   Rx   Rè   t   _schemet   _session(   Rs   t	   index_urlRç   t   use_datetimet   index_parts(    (    s0   /usr/lib/python2.7/site-packages/pip/download.pyRt   ü  s    c   
      C@  s»   |  j  | | d  d  d  f } t j | ƒ } yX i d d 6} |  j j | d | d | d t ƒ} | j ƒ  | |  _ |  j	 | j
 ƒ SWn2 t j k
 r¶ }	 t j d |	 j j | ƒ ‚  n Xd  S(   Ns   text/xmls   Content-TypeRO   R§   Rª   s   HTTP error %s while getting %s(   RI  R~   Rw   R|   RJ  t   postRm   Rã   t   verboset   parse_responseR�   R   t	   HTTPErrorR·   t   criticalRv   Rˆ   (
   Rs   RÓ   t   handlert   request_bodyRO  t   partsRy   R§   Rv   R±   (    (    s0   /usr/lib/python2.7/site-packages/pip/download.pyR     s    
	(   R˜   R™   R½   Rí   Rt   R   (    (    (    s0   /usr/lib/python2.7/site-packages/pip/download.pyRG  ÷  s   c         C@  s‰   t  |  ƒ r t |  | ƒ nV t |  ƒ rA t |  | | d | ƒn1 | d k rY t ƒ  } n  t |  | | | d | ƒ| r… t | ƒ n  d S(   sv  Unpack 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.
    R  N(   R/   R-   R0   R.   R~   RÄ   R1   R   (   Rú   Rû   R8  t   only_downloadRç   R  (    (    s0   /usr/lib/python2.7/site-packages/pip/download.pyR2     s    c         C@  s   t  j j |  ƒ S(   sJ   
    Sanitize the "filename" value from a Content-Disposition header.
    (   R�   Ré   t   basename(   R)  (    (    s0   /usr/lib/python2.7/site-packages/pip/download.pyR4   <  s    c         C@  sC   t  j |  ƒ \ } } | j d ƒ } | r9 t | ƒ } n  | pB | S(   sƒ   
    Parse the "filename" value from a Content-Disposition header, and
    return the default filename if the result is empty.
    R)  (   t   cgit   parse_headerR}   R4   (   t   content_dispositiont   default_filenamet   _typet   paramsR)  (    (    s0   /usr/lib/python2.7/site-packages/pip/download.pyR3   D  s
    c      	   C@  s“  |  j  j d d ƒ d } y0 | j | d i d d 6d t ƒ} | j ƒ  Wn2 t j k
 r} } t j d | j	 j
 |  ƒ ‚  n X| j j d	 d
 ƒ } |  j } | j j d ƒ }	 |	 rÆ t |	 | ƒ } n  t | ƒ d }
 |
 st j | ƒ }
 |
 r| |
 7} qn  |
 rI|  j  | j  k rIt j j | j  ƒ d }
 |
 rI| |
 7} qIn  t j j | | ƒ } t | d ƒ � } t | |  | | ƒ Wd QX| | f S(   s6   Download link url into temp_dir using provided sessiont   #i   i    R§   t   identitys   Accept-EncodingRª   s   HTTP error %s while getting %ss   content-typeRE   s   content-dispositiont   wbN(   Ry   R–   R}   Rm   Rã   R   RQ  R·   RR  Rv   Rˆ   R§   R)  R3   R   R¤   t   guess_extensionR�   Ré   R\   R¨   R$  (   Rú   Rç   R9  R  t
   target_urlR“   R±   R³   R)  RZ  R÷   t	   file_pathR  (    (    s0   /usr/lib/python2.7/site-packages/pip/download.pyR6  S  s:    		c         C@  sŽ   t  j j | |  j ƒ } t  j j | ƒ rŠ t j d | ƒ | r† y | j | ƒ Wq† t k
 r‚ t j	 d | ƒ t  j
 | ƒ d SXn  | Sd S(   s†    Check download_dir for previously downloaded file with correct hash
        If a correct file is found return its path else None
    s   File was already downloaded %ss;   Previously-downloaded file %s has bad hash. Re-downloading.N(   R�   Ré   R\   R)  R*  R·   R  R>  R   R¸   R7  R~   (   Rú   R8  R  t   download_path(    (    s0   /usr/lib/python2.7/site-packages/pip/download.pyR5  ‹  s    ({   t
   __future__R    RX  t   email.utilsR    R‹   RP   R  R¤   R�   RV   t   reR,  RY   R3  Ri   Rm   Rg   t   ImportErrorRí   t   pip._vendor.six.moves.urllibR   Rw   R   Rð   R5   t   pip.exceptionsR   R   t
   pip.modelsR   t	   pip.utilsR   R   R   R	   R
   R   R   R   R   R   t   pip.utils.encodingR   t   pip.utils.filesystemR   t   pip.utils.loggingR   t   pip.utils.setuptools_buildR   t   pip.utils.glibcR   t   pip.utils.uiR   R   t   pip.locationsR   t   pip.vcsR   R_   R   R   t   pip._vendor.requests.adaptersR   R   t   pip._vendor.requests.authR   R   t   pip._vendor.requests.modelsR   R    t   pip._vendor.requests.utilsR!   t   pip._vendor.requests.structuresR"   R#   t   pip._vendor.cachecontrolR$   t   pip._vendor.cachecontrol.cachesR%   t   pip._vendor.lockfileR&   t   pip._vendor.six.movesR'   t   __all__t	   getLoggerR˜   R·   Ro   Rp   Rš   R´   R¾   t   SessionRÄ   R~   R(   t   compilet   IRÚ   Rß   R)   R*   R+   R,   R-   Rø   R/   R0   R  R  R$  R2  R1   R.   RF  RH  RG  R2   R4   R3   R6  R5  (    (    (    s0   /usr/lib/python2.7/site-packages/pip/download.pyt   <module>   s¢   

F			BR!BH)			
								`	&0	$'			8