ó
^†êWc           @@  s¢  d  Z  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 m	 Z	 d d l
 m Z d d l m Z d d l m Z d d l m Z m Z m Z m Z m Z d d	 l m Z d d
 l m Z m Z d d l m Z m Z d d l m Z m  Z  m! Z! m" Z" m# Z# d d l$ m% Z% m& Z& m' Z' d d l( m) Z) d d l* m+ Z+ d g Z, e j- e. ƒ Z/ d e0 f d „  ƒ  YZ1 d e1 f d „  ƒ  YZ2 d S(   s(   Base Command class, and related routinesi    (   t   absolute_importN(   t
   cmdoptions(   t   PackageFinder(   t   running_under_virtualenv(   t
   PipSession(   t
   BadCommandt   InstallationErrort   UninstallationErrort   CommandErrort   PreviousBuildDirError(   t   logging_dictConfig(   t   ConfigOptionParsert   UpdatingDefaultsHelpFormatter(   t   InstallRequirementt   parse_requirements(   t   SUCCESSt   ERRORt   UNKNOWN_ERRORt   VIRTUALENV_NOT_FOUNDt   PREVIOUS_BUILD_DIR_ERROR(   t   deprecationt   get_progt   normalize_path(   t   IndentingFormatter(   t   pip_version_checkt   Commandc           B@  sM   e  Z d Z d Z e Z d Z e d „ Z d d d „ Z	 d „  Z
 d „  Z RS(   s   ext://sys.stdouts   ext://sys.stderrc         C@  s¹   i |  j  d 6d t ƒ  |  j f d 6t ƒ  d 6t d 6|  j d 6|  j d 6| d 6} t |   |  _ d	 |  j j ƒ  } t	 j
 |  j | ƒ |  _ t j t j |  j ƒ } |  j j | ƒ d  S(
   Nt   usages   %s %st   progt	   formattert   add_help_optiont   namet   descriptiont   isolateds
   %s Options(   R   R   R   R   t   Falset   __doc__R   t   parsert
   capitalizet   optparset   OptionGroupt   cmd_optsR   t   make_option_groupt   general_groupt   add_option_group(   t   selfR    t	   parser_kwt   optgroup_namet   gen_opts(    (    s`   /private/var/folders/3n/6h2rwf155rn1m71wwyxn79n80000gn/T/pip-build-IcAT_k/pip/pip/basecommand.pyt   __init__)   s    




c         C@  s÷   t  d | j r- t t j j | j d ƒ ƒ n d  d | d  k	 rE | n | j d | j ƒ } | j	 rr | j	 | _
 n  | j rŠ | j | _	 n  | j s™ | rº | d  k	 r« | n | j | _ n  | j rã i | j d 6| j d 6| _ n  | j | j _ | S(   Nt   cachet   httpt   retriest   insecure_hostst   https(   R   t	   cache_dirR   t   ost   patht   joint   NoneR2   t   trusted_hostst   certt   verifyt   client_certt   timeoutt   proxyt   proxiest   no_inputt   autht	   prompting(   R+   t   optionsR2   R>   t   session(    (    s`   /private/var/folders/3n/6h2rwf155rn1m71wwyxn79n80000gn/T/pip-build-IcAT_k/pip/pip/basecommand.pyt   _build_sessionA   s     -		!	
c         C@  s   |  j  j | ƒ S(   N(   R#   t
   parse_args(   R+   t   args(    (    s`   /private/var/folders/3n/6h2rwf155rn1m71wwyxn79n80000gn/T/pip-build-IcAT_k/pip/pip/basecommand.pyRG   e   s    c         @  sÿ  |  j  | ƒ \ } } | j rW | j d k r6 d ‰  n  | j d k rN d ‰  qo d ‰  n | j ri d ‰  n d ‰  ˆ  } | j r‡ d } n  t i d d 6t d	 6i i d
 d 6t j d 6d 6d 6i i t d 6d d 6d 6d 6i i ˆ  d 6d d 6|  j	 d d 6d g d 6d d 6d 6i d d 6d d 6|  j	 d d 6d d 6d 6i d d 6d d 6| j pTd d 6t
 d 6d d 6d 6d 6i | d 6t t d  d d | j r–d n d  g ƒ ƒ d 6d  6t ‡  f d! †  d" d# d$ d% g Dƒ ƒ d& 6ƒ t j d  d7 k r t j d( t j ƒ n  | j rd) t j d* <n  | j r>d+ j | j ƒ t j d, <n  | j rpt ƒ  spt j d- ƒ t j t ƒ qpn  z-y) |  j  | | ƒ } t! | t" ƒ r›| SWný t# k
 rØ} t j t$ | ƒ ƒ t j% d. d/ t
 ƒt& St' t( t) f k
 r} t j t$ | ƒ ƒ t j% d. d/ t
 ƒt* St+ k
 rP} t j d0 | ƒ t j% d. d/ t
 ƒt* St, k
 rt j d1 ƒ t j% d. d/ t
 ƒt* St j d2 d/ t
 ƒt- SXWd  | j. rút/ | d3 t ƒ rú|  j0 | d4 d d5 t1 d6 | j2 ƒ ƒ } t3 | ƒ Wd  QXn  Xt4 S(8   Ni   t   WARNINGi   R   t   CRITICALt   DEBUGt   INFOt   versiont   disable_existing_loggerss    pip.utils.logging.MaxLevelFilters   ()t   levelt   exclude_warningst   filterss   %(message)st   formatt   indentt
   formatterss(   pip.utils.logging.ColorizedStreamHandlert   classi    t   streamR   t   consolet   console_errorss+   pip.utils.logging.BetterRotatingFileHandlers	   /dev/nullt   filenamet   delayt   user_logt   handlerst   rootc         3@  s4   |  ]* } | i ˆ  d k r! d n d d 6f Vq d S(   RL   R   RI   RK   RO   N(   s   INFOs   ERROR(    (   t   .0R   (   RO   (    s`   /private/var/folders/3n/6h2rwf155rn1m71wwyxn79n80000gn/T/pip-build-IcAT_k/pip/pip/basecommand.pys	   <genexpr>¯   s   
s   pip._vendort   distlibt   requestst   urllib3t   loggersi   s   Python 2.6 is no longer supported by the Python core team, please upgrade your Python. A future version of pip will drop support for Python 2.6t   1t   PIP_NO_INPUTt    t   PIP_EXISTS_ACTIONs2   Could not find an activated virtualenv (required).s   Exception information:t   exc_infos	   ERROR: %ss   Operation cancelled by users
   Exception:t   no_indexR2   R>   i   (   i   i   (5   RG   t   quiett   verboset   logR
   R!   t   loggingRI   R   t   log_streamst   Truet   listt   filterR9   t   dictt   syst   version_infot   warningst   warnR   t   Python26DeprecationWarningRA   R6   t   environt   exists_actionR8   t   require_venvR   t   loggert   criticalt   exitR   t   runt
   isinstancet   intR	   t   strt   debugR   R   R   R   R   R   t   KeyboardInterruptR   t   disable_pip_version_checkt   getattrRF   t   minR>   R   R   (   R+   RH   RD   t
   root_levelt   statust   excRE   (    (   RO   s`   /private/var/folders/3n/6h2rwf155rn1m71wwyxn79n80000gn/T/pip-build-IcAT_k/pip/pip/basecommand.pyt   maini   sÀ    								
	#
				 	
N(   s   ext://sys.stdouts   ext://sys.stderr(   t   __name__t
   __module__R9   R   R   R!   t   hiddenRm   R/   RF   RG   R‰   (    (    (    s`   /private/var/folders/3n/6h2rwf155rn1m71wwyxn79n80000gn/T/pip-build-IcAT_k/pip/pip/basecommand.pyR   #   s   $	t   RequirementCommandc           B@  s    e  Z e d  „  ƒ Z d „  Z RS(   c         C@  s§  xS | j  D]H } x? t | d t d | d | d | d | ƒD] } |  j | ƒ q; Wq
 Wx6 | D]. } |  j t j | d d | j d | ƒƒ q] Wx? | j D]4 } |  j t j	 | d | j
 d | j d | ƒƒ q™ Wt }	 xS | j D]H } x? t | d | d | d | d | ƒD] } t }	 |  j | ƒ qWqá W| j |  _ | pK| j pK|	 s£i | d 6}
 | j r‰d	 t |
 d
 d j | j ƒ ƒ} n
 d |
 } t j | ƒ n  d S(   s?   
        Marshal cmd line args into a requirement set.
        t
   constraintt   finderRD   RE   t   wheel_cacheR    t   default_vcsR   s^   You must give at least one requirement to %(name)s (maybe you meant "pip %(name)s %(links)s"?)t   linksRe   sL   You must give at least one requirement to %(name)s (see "pip help %(name)s")N(   t   constraintsR   Rn   t   add_requirementR   t	   from_lineR9   t   isolated_modet	   editablest   from_editableR‘   R!   t   requirementst   require_hashest
   find_linksRq   R8   Rz   t   warning(   t   requirement_setRH   RD   R   RE   R   R   RY   t   reqt   found_req_in_filet   optst   msg(    (    s`   /private/var/folders/3n/6h2rwf155rn1m71wwyxn79n80000gn/T/pip-build-IcAT_k/pip/pip/basecommand.pyt   populate_requirement_set  sF    			"c         C@  s~   | j  g | j } | j r> t j d d j | ƒ ƒ g  } n  t d | j d | j d | d | j	 d | j
 d | j d	 | ƒ S(
   sR   
        Create a package finder appropriate to this requirement command.
        s   Ignoring indexes: %st   ,R›   t   format_controlt
   index_urlsR:   t   allow_all_prereleasest   process_dependency_linksRE   (   t	   index_urlt   extra_index_urlsRh   Rz   t   infoR8   R   R›   R¤   R:   t   preR§   (   R+   RD   RE   R¥   (    (    s`   /private/var/folders/3n/6h2rwf155rn1m71wwyxn79n80000gn/T/pip-build-IcAT_k/pip/pip/basecommand.pyt   _build_package_finder:  s    							(   RŠ   R‹   t   staticmethodR¢   R¬   (    (    (    s`   /private/var/folders/3n/6h2rwf155rn1m71wwyxn79n80000gn/T/pip-build-IcAT_k/pip/pip/basecommand.pyR     s   7(3   R"   t
   __future__R    Rl   R6   Rr   R%   Rt   t   pipR   t	   pip.indexR   t   pip.locationsR   t   pip.downloadR   t   pip.exceptionsR   R   R   R   R	   t
   pip.compatR
   t   pip.baseparserR   R   t   pip.reqR   R   t   pip.status_codesR   R   R   R   R   t	   pip.utilsR   R   R   t   pip.utils.loggingR   t   pip.utils.outdatedR   t   __all__t	   getLoggerRŠ   Rz   t   objectR   R   (    (    (    s`   /private/var/folders/3n/6h2rwf155rn1m71wwyxn79n80000gn/T/pip-build-IcAT_k/pip/pip/basecommand.pyt   <module>   s,   ((	Þ