ó
qw4Zc           @` s  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 m Z d d l m Z d d l m Z d d	 l m Z m Z d d
 l m Z d d l m Z d d l m Z e e  Z d d d     YZ d   Z d   Z d S(   i    (   t   absolute_importt   divisiont   print_functiont   unicode_literals(   t   import_module(   t	   getLogger(   t   spliti   (   t   APP_NAMEt   SEARCH_PATH(   t   context(   t   generate_parser(   t   capturedt   replace_log_streams(   t   win_path_double_escape(   t   conda_exception_handler(   t   initialize_std_loggerst   Commandsc           B` s>   e  Z d  Z d Z d Z d Z d Z d Z d Z d Z	 d Z
 RS(	   u   configu   cleanu   createu   infou   installu   listu   removeu   searchu   update(   t   __name__t
   __module__t   CONFIGt   CLEANt   CREATEt   INFOt   INSTALLt   LISTt   REMOVEt   SEARCHt   UPDATE(    (    (    s3   lib/python2.7/site-packages/conda/cli/python_api.pyR      s   c         C` s   d |  } t  |  j S(   Nu   conda.cli.main_(   R   t   configure_parser(   t   commandt   module(    (    s3   lib/python2.7/site-packages/conda/cli/python_api.pyt   get_configure_parser_function   s    
c         O` s  t    | j d t  } | j d t  } t   \ } } t |   |  t t |  } d |  d j |  f } t	 |  } | j
 |  }	 t |	 _ t j d | d t d |	  t j d |  yV t   G }
 t   5 | rų t |	 j |	 |  } n |	 j |	 |  } Wd	 QXWd	 QXWnK t k
 re} t j d
 |
 j |
 j  |
 j |
 j | _ | _ |  n Xt j d |
 j |
 j |  |
 j |
 j | f S(   uĒ  Runs a conda command in-process with a given set of command-line interface arguments.

    Differences from the command-line interface:
        Always uses --yes flag, thus does not ask for confirmation.

    Args:
        command: one of the Commands.X
        *arguments: instructions you would normally pass to the conda comamnd on the command line
                    see below for examples
        **kwargs: special instructions for programmatic overrides
          use_exception_handler: defaults to False.  False will let the code calling
              `run_command` handle all exceptions.  True won't raise when an exception
              has occured, and instead give a non-zero return code
          search_path: an optional non-standard search path for configuration information
              that overrides the default SEARCH_PATH

    Returns: a tuple of stdout, stderr, and return_code

    Examples:
        >>  run_command(Commands.CREATE, "-n newenv python=3 flask", use_exception_handler=True)
        >>  run_command(Commands.CREATE, "-n newenv", "python=3", "flask")
        >>  run_command(Commands.CREATE, ["-n newenv", "python=3", "flask"], search_path=())


    u   use_exception_handleru   search_pathu   %s %su    t   search_patht   app_namet   argparse_argsu   executing command >>>  conda %sNu   
  stdout: %s
  stderr: %su,   
  stdout: %s
  stderr: %s
  return_code: %s(   R   t   gett   FalseR   R
   R   t   mapR   t   joinR   t
   parse_argst   Truet   yesR	   t   __init__R   t   logt   debugR   R   R   t   funct	   Exceptiont   stdoutt   stderr(   R   t	   argumentst   kwargst   use_exception_handlert   configuration_search_patht   pt   sub_parserst   command_linet   split_command_linet   argst   ct   return_codet   e(    (    s3   lib/python2.7/site-packages/conda/cli/python_api.pyt   run_command$   s6    		 
"
N(    (    t
   __future__R    R   R   R   t	   importlibR   t   loggingR   t   shlexR   t   base.constantsR   R   t   base.contextR	   t   cli.mainR
   t	   common.ioR   R   t   common.pathR   t
   exceptionsR   t   gateways.loggingR   R   R+   R   R   R=   (    (    (    s3   lib/python2.7/site-packages/conda/cli/python_api.pyt   <module>   s   "	