B
    lz]                 @   s   d Z ddlmZmZmZmZ ddlZdadd ZdddZ	dd	 Z
ejd
krbejd dkrbdd Zdd Zedkr~ee  dS )ap  conda is a tool for managing environments and packages.

conda provides the following commands:

    Information
    ===========

    info       : display information about the current install
    list       : list packages linked into a specified environment
    search     : print information about a specified package
    help       : display a list of available conda commands and their help
                 strings

    Package Management
    ==================

    create     : create a new conda environment from a list of specified
                 packages
    install    : install new packages into an existing conda environment
    update     : update packages in a specified conda environment


    Packaging
    =========

    package    : create a conda package in an environment

Additional help for each command can be accessed by using:

    conda <command> -h
    )absolute_importdivisionprint_functionunicode_literalsNc              C   s"   t d k	rt S ddlm}  |  a t S )N   )generate_parser)PARSERconda_argparser   )r    r
   -lib/python3.7/site-packages/conda/cli/main.pyr   *   s
    r   c             C   sh   ddl m}m} ddlm}m} |  | rP| jrPxdD ]}|||d  q6W | rd| jrd|| j d S )Nr   )CRITICAL	getLogger   )initialize_loggingset_verbosity)zconda.stdout.verbosezconda.stdoutlogzconda.stderrlogr   )	Zloggingr   r   Zgateways.loggingr   r   ZjsonZsetLevel	verbosity)contextr   r   r   r   Zloggerr
   r
   r   init_loggers6   s    


r   c              O   s   t | dkr| d } t }|| dd  } ddlm} |j| d t| |dd }|rf|| | ddlm	} || |}t
|tr|S d S )Nr   )z-hr   )r   )Zargparse_argspost_parse_hook)do_call)lenr   
parse_argsZbase.contextr   __init__r   popr	   r   
isinstanceint)argskwargspr   r   r   Z	exit_coder
   r
   r   _mainC   s    


r   win32r   c                 s   ddl m} m}m}m}m} ddlm}m} |j	j
}g |_||_|jj}|| |g|_| ||_| }	|d}
||	||
 |
jdkr|
jttj } fddt||
jD S dS )a  Uses shell32.GetCommandLineArgvW to get sys.argv as a list of Unicode
        strings.

        Versions 2.x of Python don't support Unicode in sys.argv on
        Windows, with the underlying Windows API instead replacing multi-byte
        characters with '?'.
        r   )POINTERbyrefcdllc_intwindll)LPCWSTRLPWSTRc                s   g | ]} | qS r
   r
   ).0i)argvr
   r   
<listcomp>t   s    z&win32_unicode_argv.<locals>.<listcomp>N)Zctypesr!   r"   r#   r$   r%   Zctypes.wintypesr&   r'   Zkernel32GetCommandLineWZargtypesZrestypeZshell32CommandLineToArgvWvaluer   sysr*   range)r!   r"   r#   r$   r%   r&   r'   r,   r-   cmdZargcstartr
   )r*   r   win32_unicode_argvZ   s    	

r3   c                 s  ddl m m} |  | sFtjdkr@tjd dkr@t  } t_ntj} t fdd| D } t	| dkr yT| d 
 }|drdd	lm} | S |d
rdd lm  m} |  d S W n@ tk
 r   t \}}}t  ddlm}	 |	 ||S X ddlm}
 |
tf| |S )Nr   )ensure_text_typeinit_std_stream_encodingr    r   c             3   s   | ]} |V  qd S )Nr
   )r(   s)r4   r
   r   	<genexpr>   s    zmain.<locals>.<genexpr>r   zshell.)mainz..)ExceptionHandler)conda_exception_handler)Zcommon.compatr4   r5   r/   platformversion_infor3   r*   tupler   strip
startswithactivater8   Zconda.cli.activateZcli	Exceptionexc_infor   
exceptionsr9   Zhandle_exceptionr:   r   )r   r   r5   Zargv1Zactivator_mainr@   _Zexc_valZexc_tbr9   r:   r
   )r4   r   r8   w   s0    

r8   __main__)N)__doc__Z
__future__r   r   r   r   r/   r   r   r   r   r;   r<   r3   r8   __name__exitr
   r
   r
   r   <module>"   s   
"