σ
έ²k^c           @` s  d  d l  m Z m Z m Z m Z d  d l Z d  d l m Z m Z d  d l	 Z
 d  d l Z d d l m Z m Z m Z d d l m Z d   Z d   Z d	   Z d
   Z e d  Z e d  Z e d  Z d   Z e d d e j e d k re   n  d S(   i    (   t   absolute_importt   divisiont   print_functiont   unicode_literalsN(   t   abspatht   isdiri   (   t   ensure_text_typet   on_wint	   text_type(   t   shellsc         C` sέ   |  d k rV | d k r7 d d l  m } | d   qΩ d d l  m } | d   n |  d	 k r¬ | d k r d d l  m } | d
   qΩ d d l  m } | d   n- d d l  m } | d t t j d    d  S(   Nu
   ..activateu
   ..checkenvu   cmd.exeu   powershell.exei   (   t   CondaSystemExituΓ   Usage: activate ENV

Adds the 'Scripts' and 'Library\bin' directory of the environment ENV to the front of PATH.
ENV may either refer to just the name of the environment, or the full
prefix path.u΄   Usage: source activate ENV

Adds the 'bin' directory of the environment ENV to the front of PATH.
ENV may either refer to just the name of the environment, or the full
prefix path.u   ..deactivateu   Usage: deactivate

Removes the environment prefix, 'Scripts' and 'Library\bin' directory
of the environment ENV from the front of PATH.uu   Usage: source deactivate

Removes the 'bin' directory of the environment activated with 'source
activate' from PATH. u    No help available for command %si   (   u
   ..activateu
   ..checkenv(   u   cmd.exeu   powershell.exe(   u   cmd.exeu   powershell.exe(   t
   exceptionsR
   R   t   syst   argv(   t   commandt   shellR
   (    (    s1   lib/python2.7/site-packages/conda/cli/activate.pyt   help   s$    c         C` s    d d l  m } | | |  j  S(   Ni   (   t   locate_prefix_by_name(   t   base.contextR   t	   envs_dirs(   t   ctxt   nameR   (    (    s1   lib/python2.7/site-packages/conda/cli/activate.pyR   5   s    c         C` sΤ   | r t  | n i  } d d l m } | d |  k r― t j d |   r― | d |   } t t | j d    r t | j d   } qΠ d d l m	 } | d |   n! t
 | |  j d	 t j j   } | S(
   Ni   (   t   contextu   sepu	   [a-zA-Z]:u	   path_fromu   "(   t   CondaValueErroru   Could not find environment: %su   /(   R	   R   R   t   regext   matchR   R   t   stripR   R   R   t   replacet   ost   patht   sep(   t   argR   t	   shelldictR   t   native_patht   prefixR   (    (    s1   lib/python2.7/site-packages/conda/cli/activate.pyt   prefix_from_arg:   s    #!c         c` s’   t  r |  j d  Vt j j |  d d d  Vt j j |  d d d  Vt j j |  d d  Vt j j |  d  Vt j j |  d  Vn t j j |  d  Vd  S(   Nu   \u   Libraryu	   mingw-w64u   binu   usru   Scripts(   R   t   rstripR   R   t   join(   R"   (    (    s1   lib/python2.7/site-packages/conda/cli/activate.pyt   _get_prefix_pathsM   s    c         C` ss   | r t  | n i  } t |  |  } | rR g  t |  D] } | d |  ^ q8 Sg  t |  D] } | ^ q_ Sd  S(   Nu   path_to(   R	   R#   R&   (   R   R   t   going_to_shellR    R"   R   (    (    s1   lib/python2.7/site-packages/conda/cli/activate.pyt   binpath_from_argY   s
    'c         C` sI   d j  |   } t r3 | r3 t j d d |  } n | j d d  } | S(   uf   
    Format a path list, e.g., of bin paths to be added or removed,
    for user-friendly output.
    u    and u   (?<!\\)\\(?!\\)u   \\\\u   \\u   \(   R%   R   R   t   subR   (   t   pathst   escape_backslashesR   (    (    s1   lib/python2.7/site-packages/conda/cli/activate.pyt   pathlist_to_strd   s
    c         C` sZ   | r t  | n i  } t |  | |  } | rD | d j |  } n t j j |  } | S(   Nu   pathsep(   R	   R(   R%   R   t   pathsep(   R"   R   R'   R    t   binpathR   (    (    s1   lib/python2.7/site-packages/conda/cli/activate.pyt   get_activate_pathr   s    c          C` sΘ  t  d d t j d d l m }  d d l m } |   t d   t j D  } d | k sk d | k r t	 | d	 | d  n  t
 |  d k r’ | d } n d
 } t j d | d	  rmt
 |  } | d k rmd } | d k  rd d l m } | | | | d j | d	    n  | d k rjd d l m } | | | | | d d j | d	    qjqmn  | d	 d k r§t  t | d | t   t j d  n| d	 d k rqt | d | t  } t j d  rt j d t j |  d t j t d  d	  }	 n2 t j d t j |  d
 t j t d  d	  }	 t | d |	  }	 t  |	  t j d  nI| d	 d k rlt
 |  d k  r²d d l m }
 |
 d   n  t
 |  d k rγd d l m }
 |
 d   n  | d j   |  j   k rt j d  n  y t | d |  Wn5 t k
 r[} d d l m  } | t! |    n Xt j d  nN | d	 d k rd d  l" m# } t$ | j%  } n d d l m  } | d!   t  |  d  S("   Nu   WARNING: The module conda.cli.activate is deprecated. It will be removed in a future feature release (i.e. minor version release).t   filei   (   t   ROOT_ENV_NAME(   t   initialize_loggingc         s` s   |  ] } t  |  Vq d  S(   N(   R   (   t   .0t   s(    (    s1   lib/python2.7/site-packages/conda/cli/activate.pys	   <genexpr>   s    u   -hu   --helpi   u    u   ^..(?:de|)activate$i   (   t   TooFewArgumentsErroru`   {} expected exactly two arguments:                                            shell and env name(   t   TooManyArgumentsErrorua   {} expected exactly two arguments:                                             shell and env nameu
   ..activatei   i    u   ..deactivate.pathu   _CONDA_HOLDu   %s(:?)u   CONDA_PATH_PLACEHOLDER\1u   PATHu   path_tou
   ..checkenv(   t   ArgumentErroru<   Invalid arguments to checkenv.  Need shell and env name/pathu&   did not expect more than one argument.(   R   u   ..changeps1(   R   u   unexpected command(&   t   printR   t   stderrt   base.constantsR1   t   gateways.loggingR2   t   tupleR   R   t   lenR   R   R   R5   t   formatR6   R/   t   Truet   exitt   FalseR   t   getenvR)   t   escapet   environt   strR	   R7   t   lowerR#   t
   ValueErrorR   R   R   R   t   intt	   changeps1(   R1   R2   t   sys_argvR   t   arg_numt   num_expectedR5   R6   t   activation_patht   new_pathR7   t   eR   R   R   (    (    s1   lib/python2.7/site-packages/conda/cli/activate.pyt   main~   st    	

u]   WARNING: The conda.cli.activate module is deprecated and will be removed in a future release.R0   u   __main__(   t
   __future__R    R   R   R   R   t   os.pathR   R   t   reR   R   t   common.compatR   R   R   t   utilsR	   R   R   R#   R&   R?   R(   R,   R/   RP   R8   R9   t   __name__(    (    (    s1   lib/python2.7/site-packages/conda/cli/activate.pyt   <module>   s$   "	&				e	
