ó
ū_¾Tc           @   sP  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 d  d l	 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 l m Z d   Z d	   Z d d
  Z d   Z d e f d     YZ e d d e e j d d d  Z e  d k rLe   Z! e! rLe j! e!  qLn  d S(   i’’’’N(   t   walk_packagest   console_to_str(   t   command_dictt   load_commandt   load_all_commandst   command_names(   t   parser(   t   InstallationError(   t   logger(   t   get_installed_distributionsc          C   sy  d t  j k r d St  j d j   d }  t t  j d  } y |  | d } Wn t k
 rh d } n Xt   g  t j   D] \ } } | j s} | ^ q} } g  } y- g  |  D] } | | k r® | ^ q® d } Wn t k
 rź d } n X| rß| d k rt
 j d  n  | d	 k r¼| j d
  r¼g  }	 | j   }
 xO t d t  D]> } | j j |
  rK| j |  d k rK|	 j | j  qKqKW|	 r¼x |	 D] } | GHqWt
 j d  q¼n  t j |  } | 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 rG| | f ^ qG} g  | D]' \ } } | j |  rx| | f ^ qx} xĄ | D], } | d } | d rÓ| d 7} n  | GHq¬Wn | j d
  sż| j d  r8| g  t j D]$ } | j t j k r
| j   ^ q
7} n  d j g  | D] } | j |  rE| ^ qE 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   --t    (   t   ost   environt   splitt   intt
   IndexErrorR   R   t   itemst   hiddent   Nonet   syst   exitt
   startswitht   lowerR	   t   Truet   keyt   appendt   getR   t   option_listR   t   optparset   SUPPRESS_HELPt   get_opt_stringt   nargst   join(   t   cwordst   cwordt   currentt   cmdt   clst   subcommandst   optionst   wt   subcommand_namet	   installedt   lct   distt
   subcommandt   optt   xt	   prev_optst   vt   kt   optiont	   opt_label(    (    sd   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/pip-1.1-py2.7.egg/pip/__init__.pyt   autocomplete   s\    
.-
%	.114

(0c          C   sQ   d d l  m }  x: t d |  j d |  j d  D] \ } } } t |  q0 Wd  S(   Ni’’’’(   t   vcst   patht   prefixt   .(   t   pipR?   R    t   __path__t   __name__t
   __import__(   R?   t   importert   modnamet   ispkg(    (    sd   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/pip-1.1-py2.7.egg/pip/__init__.pyt   version_controlS   s    ,c         C   sS  |  d  k r t j d }  n  t   t   t j |   \ } } | j r[ | r[ d g } n  | sq t j d  n  | d j	   } t
 |  | t k r5t j | t    } | ré | d } | d ró d | d j | d  f } qó n
 d | } i | d 6| d	 6t j j t j d  d
 6} t j d |  n  t | } | j | d |  S(   Ni   R   sB   You must give a command (use "pip help" to see a list of commands)i    s   %s %sR   s
   install %st   argt   guesst   scriptsT   No command by the name %(script)s %(arg)s
  (maybe you meant "%(script)s %(guess)s")(   R   R   t   argvR>   RJ   R   t
   parse_argsR   t   errorR   R   R   t   difflibt   get_close_matchesR   R)   R   R@   t   basenamet   main(   t   initial_argsR0   t   argst   commandt   close_commandsRL   t
   error_dict(    (    sd   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/pip-1.1-py2.7.egg/pip/__init__.pyRT   [   s0    


#
	
c           C   s   t  d d d g  S(   sI   
    Bootstrapping function to be called from install-pip.py script.
    t   installs	   --upgradeRC   (   RT   (    (    (    sd   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/pip-1.1-py2.7.egg/pip/__init__.pyt	   bootstrapw   s    t   FrozenRequirementc           B   s\   e  Z d d   Z e j d  Z e j d  Z e e d   Z	 e
 d    Z d   Z RS(   c         C   s(   | |  _  | |  _ | |  _ | |  _ d  S(   N(   t   namet   reqt   editablet   comments(   t   selfR]   R^   R_   R`   (    (    sd   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/pip-1.1-py2.7.egg/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 } | j |  r¦ t	 } | | | |  }	 |	 d  k rąt j d |  | j d  | j   }	 t } qąn:t } | j   }	 |	 j }
 t |
  d k rē |
 d d d k sķ t  |
 d d } |  j j |  } |  j j |  } | s+| rą| j d  } | rX|   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’’’’(   R?   t   get_src_requirements-   Could not determine repository location of %ss-   ## !! Could not determine repository locationi   i    s   ==t   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(   R   R@   t   normcaset   abspatht   locationt   pip.vcsR?   Rc   t   get_backend_nameR    R   R   t   warnR"   t   as_requirementt   Falset   specst   lent   AssertionErrort   _rev_ret   searcht   _date_ret   get_backendt   get_locationt   groupt   egg_namet   project_name(   R.   R5   t   dependency_linkst	   find_tagsRg   R`   R?   Rc   R_   R^   Rm   t   versiont	   ver_matcht
   date_matcht   svn_backendt   svn_locationt   rev(    (    sd   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/pip-1.1-py2.7.egg/pip/__init__.pyt	   from_dist   sD    !	,	c         C   s;   |  j    } t j d |  } | r7 | | j    } n  | S(   Ns
   -py\d\.\d$(   Rv   t   reRq   t   start(   R5   R]   t   match(    (    sd   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/pip-1.1-py2.7.egg/pip/__init__.pyRv   “   s
    c         C   sF   |  j  } |  j r d | } n  d j t |  j  t |  g  d S(   Ns   -e %ss   
(   R^   R_   R)   t   listR`   t   str(   Ra   R^   (    (    sd   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/pip-1.1-py2.7.egg/pip/__init__.pyt   __str__¼   s    		(    (   RE   t
   __module__Rb   R   t   compileRp   Rr   t   classmethodRl   R   t   staticmethodRv   R   (    (    (    sd   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/pip-1.1-py2.7.egg/pip/__init__.pyR\      s   'c         C   sį  | d  k r g  } xd |  D]\ }	 d |	 k sO d |	 k sO d |	 k sO d |	 k rh d |	 j d d  }	 n  | j |	  q Wd j |  } n  | r d  }
 n	 t j }
 t j | d |  t j	 j
   } | rÜ | j |  n  y4 t j |  d t j d	 d  d
 |
 d | d | } Wn; t k
 rMt j   d } t j d | | f    n Xg  } |
 d  k	 r| j }
 xĢ t |
 j    } | sPn  | j   } | j | d  | r| |  } t | t  rÕ| \ } } n  t j | |  t j |  st j   qqlt j |  qln! | j   \ } } | p2d g } | j   | j rÄ| r¤| rt j d |  t j d j |  d  n  t d | | j | f   qÄt j  d | | j | f  n  |
 d  k	 rŻd j |  Sd  S(   NR   s   
t   "t   's   "%s"s   \"s   Running command %st   stderrt   stdint   stdoutt   cwdt   envi   s#   Error %s while executing command %sR   s    Complete output from command %s:s)   
----------------------------------------s*   Command %s failed with error code %s in %ss"   Command %s had error code %s in %s(!   R   t   replaceR"   R)   t
   subprocesst   PIPER   t   logR   R   t   copyt   updatet   Popent   STDOUTt	   ExceptionR   t   exc_infot   fatalR   R   t   readlinet   rstript
   isinstancet   tuplet   stdout_level_matchest   show_progresst   infot   communicatet   waitt
   returncodet   notifyR   Rj   (   R-   t   show_stdoutt   filter_stdoutR   t   raise_on_returncodet   command_levelt   command_desct   extra_environt	   cmd_partst   partR   R   t   proct   et
   all_outputt   linet   levelt   returned_stdoutt   returned_stderr(    (    sd   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/pip-1.1-py2.7.egg/pip/__init__.pyt   call_subprocessĘ   sp    0			
	t   __main__("   R   R%   R   R   R   RQ   t   pip.backwardcompatR    R   t   pip.basecommandR   R   R   R   t   pip.baseparserR   t   pip.exceptionsR   t   pip.logR   t   pip.utilR	   R>   RJ   R   RT   R[   t   objectR\   R    t   DEBUGR·   RE   R   (    (    (    sd   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/pip-1.1-py2.7.egg/pip/__init__.pyt   <module>   s2   "	A		
E	?	