
^Wc           @@  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	 m
 Z
 m Z 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 d  d l m Z m Z d  d l m Z m Z d  d	 l m Z d  d
 l m Z d  d l  Z! e! j" Z" d Z# e j$ e%  Z& e j' d d e d   Z( d   Z) d   Z* d   Z+ d d  Z- d e. f d     YZ/ e% d k re j0 e-    n  d S(   i    (   t   absolute_importN(   t   InstallationErrort   CommandErrort   PipError(   t   get_installed_distributionst   get_prog(   t   deprecationt   dist_is_editable(   t   gitt	   mercurialt
   subversiont   bazaar(   t   ConfigOptionParsert   UpdatingDefaultsHelpFormatter(   t   get_summariest   get_similar_commands(   t   commands_dict(   t   InsecureRequestWarnings   8.1.2t   ignoret   categoryc          C@  s  d t  j k r d St  j d j   d }  t t  j d  } y |  | d } Wn t k
 rh d } n Xg  t   D] \ } } | ^ qs } g  } y- g  |  D] } | | k r | ^ q d } Wn t k
 r d } n Xt   }	 | r| d k rt j	 d  n  | d	 k r| j
 d
  rg  }
 | j   } xO t d t  D]> } | j j
 |  rA| j |  d k rA|
 j | j  qAqAW|
 rx |
 D] } | GHqWt j	 d  qn  t |   } | g  | j j D]- } | j t j k r| j   | j f ^ q7} g  |  d | d !D] } | j d  d ^ q} g  | D]$ \ } } | | k r;| | f ^ q;} g  | D]' \ } } | j
 |  rl| | f ^ ql} x | D], } | d } | d r| d 7} n  | GHqWn | j
 d
  s| j
 d  rhg  |	 j D] } | j ^ q} | j |	 j  d   | D } | g  | D]$ } | j t j k r:| j   ^ q:7} n  d j g  | D] } | j
 |  ru| ^ qu GHt j	 d  d S(   s   Command and option completion for the main option parser (and options)
    and its subcommands (and options).

    Enable by sourcing one of the completion shell scripts (bash or zsh).
    t   PIP_AUTO_COMPLETENt
   COMP_WORDSi   t
   COMP_CWORDt    i    t   helpt	   uninstallt   -t
   local_onlyt   =s   --c         s@  s"   |  ] } | D] } | Vq q d  S(   N(    (   t   .0t   itt   o(    (    s]   /private/var/folders/3n/6h2rwf155rn1m71wwyxn79n80000gn/T/pip-build-IcAT_k/pip/pip/__init__.pys	   <genexpr>k   s    t    (   t   ost   environt   splitt   intt
   IndexErrorR   t   Nonet   create_main_parsert   syst   exitt
   startswitht   lowerR   t   Truet   keyt   appendR   t   parsert   option_list_allR   t   optparset   SUPPRESS_HELPt   get_opt_stringt   nargst   option_groupst   option_listt   join(   t   cwordst   cwordt   currentt   cmdt   summaryt   subcommandst   optionst   wt   subcommand_nameR/   t	   installedt   lct   distt
   subcommandt   optt   xt	   prev_optst   vt   kt   optiont	   opt_labelt   it   opts(    (    s]   /private/var/folders/3n/6h2rwf155rn1m71wwyxn79n80000gn/T/pip-build-IcAT_k/pip/pip/__init__.pyt   autocomplete+   s`    
"-
	%	.114

(0c          C@  s  i d d 6t  d 6t   d 6d d 6t   d 6}  t |    } | j   t j j t j j t j j t	    } d t
 | t j d	  f | _ t j t j |  } | j |  t | _ t   } d
 g g  | D] \ } } d | | f ^ q } d j |  | _ | S(   Ns   
%prog <command> [options]t   usaget   add_help_optiont	   formattert   globalt   namet   progs   pip %s from %s (python %s)i   R   s   %-27s %ss   
(   t   FalseR   R   R   t   disable_interspersed_argsR!   t   patht   dirnamet   abspatht   __file__t   __version__R(   t   versiont
   cmdoptionst   make_option_groupt   general_groupt   add_option_groupR,   t   mainR   R7   t   description(   t	   parser_kwR/   t   pip_pkg_dirt   gen_optst   command_summariesRL   t   jRb   (    (    s]   /private/var/folders/3n/6h2rwf155rn1m71wwyxn79n80000gn/T/pip-build-IcAT_k/pip/pip/__init__.pyR'   t   s$    

*		0c         C@  s  t    } | j |   \ } } | j rZ t j j | j  t j j t j  t j   n  | s | d d k r t	 |  d k r | j
   t j   n  | d } | t k r t |  } d | g } | r | j d |  n  t d j |    n  |  } | j |  | | f S(   Ni    R   i   s   unknown command "%s"s   maybe you meant "%s"s    - (   R'   t
   parse_argsR\   R(   t   stdoutt   writeR!   t   linesepR)   t   lent
   print_helpR   R   R.   R   R7   t   remove(   t   argsR/   t   general_optionst	   args_elset   cmd_namet   guesst   msgt   cmd_args(    (    s]   /private/var/folders/3n/6h2rwf155rn1m71wwyxn79n80000gn/T/pip-build-IcAT_k/pip/pip/__init__.pyt	   parseopts   s&    			)

c         C@  s   t  } d |  k r t } n  | S(   Ns
   --isolated(   RU   R,   (   Ro   t   isolated(    (    s]   /private/var/folders/3n/6h2rwf155rn1m71wwyxn79n80000gn/T/pip-build-IcAT_k/pip/pip/__init__.pyt   check_isolated   s    	c         C@  s   |  d  k r t j d }  n  t j   t   y t |   \ } } WnG t k
 r } t j j	 d |  t j j	 t
 j  t j d  n Xy t j t j d  Wn& t j k
 r } t j d |  n Xt | d t |   } | j |  S(   Ni   s	   ERROR: %sR   s%   Ignoring error %s when setting localeRw   (   R&   R(   t   argvR   t   install_warning_loggerRN   Rv   R   t   stderrRj   R!   Rk   R)   t   localet	   setlocalet   LC_ALLt   Errort   loggert   debugR   Rx   Ra   (   Ro   Rr   Ru   t   exct   et   command(    (    s]   /private/var/folders/3n/6h2rwf155rn1m71wwyxn79n80000gn/T/pip-build-IcAT_k/pip/pip/__init__.pyRa      s     
t   FrozenRequirementc           B@  sY   e  Z d d   Z e j d  Z e j d  Z e d    Z e	 d    Z
 d   Z RS(   c         C@  s(   | |  _  | |  _ | |  _ | |  _ d  S(   N(   RS   t   reqt   editablet   comments(   t   selfRS   R   R   R   (    (    s]   /private/var/folders/3n/6h2rwf155rn1m71wwyxn79n80000gn/T/pip-build-IcAT_k/pip/pip/__init__.pyt   __init__   s    			s   -r(\d+)$s   -(20\d\d\d\d\d\d)$c         C@  s=  t  j j t  j j | j   } g  } d d l m } m } t |  r | j	 |  r t
 } y | | |  } Wn) t k
 r }	 t j d |	  d  } n X| d  k r't j d |  | j d  | j   } t } q'nIt } | j   } | j }
 t |
  d k r|
 d d d k s5t d	 |
 | f   |
 d d } |  j j |  } |  j j |  } | ss| r'| j d
  } | r|   j | |  } n  | st j d |  | j d  q'| j d |  | r| j d  } n d | j d  } t
 } d | | |  j |  f } n  |  | j | | |  S(   Ni    (   t   vcst   get_src_requirementsY   Error when trying to get requirement for VCS system %s, falling back to uneditable formats-   Could not determine repository location of %ss-   ## !! Could not determine repository locationi   s   ==s   ===s5   Expected 1 spec with == or ===; specs = %r; dist = %rt   svns(   Warning: cannot find svn location for %ssF   ## FIXME: could not find svn URL in dependency_links for this package:s3   # Installing as editable to satisfy requirement %s:s   {%s}s   %s@%s#egg=%s(   s   ==s   ===(   R!   RW   t   normcaseRY   t   locationt   pip.vcsR   R   R   t   get_backend_nameR,   R   R   t   warningR&   R.   t   as_requirementRU   t   specsRl   t   AssertionErrort   _rev_ret   searcht   _date_ret   get_backendt   get_locationt   groupt   egg_namet   project_name(   t   clsRC   t   dependency_linksR   R   R   R   R   R   R   R   R\   t	   ver_matcht
   date_matcht   svn_backendt   svn_locationt   rev(    (    s]   /private/var/folders/3n/6h2rwf155rn1m71wwyxn79n80000gn/T/pip-build-IcAT_k/pip/pip/__init__.pyt	   from_dist   sf    !

	)	

c         C@  s;   |  j    } t j d |  } | r7 | | j    } n  | S(   Ns
   -py\d\.\d$(   R   t   reR   t   start(   RC   RS   t   match(    (    s]   /private/var/folders/3n/6h2rwf155rn1m71wwyxn79n80000gn/T/pip-build-IcAT_k/pip/pip/__init__.pyR   /  s
    c         C@  sF   |  j  } |  j r d | } n  d j t |  j  t |  g  d S(   Ns   -e %ss   
(   R   R   R7   t   listR   t   str(   R   R   (    (    s]   /private/var/folders/3n/6h2rwf155rn1m71wwyxn79n80000gn/T/pip-build-IcAT_k/pip/pip/__init__.pyt   __str__7  s    		(    (   t   __name__t
   __module__R   R   t   compileR   R   t   classmethodR   t   staticmethodR   R   (    (    (    s]   /private/var/folders/3n/6h2rwf155rn1m71wwyxn79n80000gn/T/pip-build-IcAT_k/pip/pip/__init__.pyR      s   At   __main__(1   t
   __future__R    R|   t   loggingR!   R1   t   warningsR(   R   t   pip.exceptionsR   R   R   t	   pip.utilsR   R   R   R   R   R   R	   R
   R   t   pip.baseparserR   R   t   pip.commandsR   R   R   t0   pip._vendor.requests.packages.urllib3.exceptionsR   t   pip.cmdoptionst   pipR]   R[   t	   getLoggerR   R   t   filterwarningsRN   R'   Rv   Rx   R&   Ra   t   objectR   R)   (    (    (    s]   /private/var/folders/3n/6h2rwf155rn1m71wwyxn79n80000gn/T/pip-build-IcAT_k/pip/pip/__init__.pyt   <module>   s8   "
		I		*		[