U
    b]                     @   s  d dl mZmZmZmZ d dlmZmZm	Z	m
Z
mZmZmZ d dlmZ d dlZd dlmZmZmZ d dlmZ d dlZd dlmZ dd	lmZ dd
lmZ ddlmZm Z m!Z!m"Z"m#Z# ddl$m%Z% ee&Z'e(ej)dkZ*eedZ+e+,ddZ-eeej.d,ddZ/dd Z0dd Z1dd Z2G dd deZdd Z3dd Z4dd Z5G d d! d!eZ6G d"d# d#eZ7d$d% Z8d&d' Z9d(d) Z:d*d+ Z;d,d- Z<d.d/ Z=d0d1 Z>d2d3 Z?d4d5 Z@djd7d8ZAd9d: ZBd;d< ZCdkd>d?ZDd@ZEedAeE dBZFdldDdEZGddFdGdHZHdmdJdKZIdLdM ZJdNdO ZKdPdQ ZLdndRdSZMdTdU ZNdVdW ZOdXdY ZPdZd[ ZQd\d] ZRd^d_ ZSd`da ZTdbdc ZUddde ZVdfdg ZWdhdi ZXdS )o    )absolute_importdivisionprint_functionunicode_literals)ArgumentParser	REMAINDERRawDescriptionHelpFormatterSUPPRESSAction_CountAction_HelpAction)	getLoggerN)abspath
expanduserjoin)Popen)dedent   )__version__)dals)COMPATIBLE_SHELLSCONDA_HOMEPAGE_URLDepsModifierUpdateModifierExperimentalSolverChoice)NULLZwin32z
~/.condarc%%%z.condarcc                  C   s   t dd} | jddddt dd | jd	d
td | jdd
td | jddd}d|_t| t| t| t	| t
| t| t| t| t| t| t| t| t| t|dd t| t|dd t| | S )NzSconda is a tool for managing and deploying applications, environments and packages.)descriptionz-Vz	--versionversionzconda %sz'Show the conda version number and exit.)actionr   help--debug
store_truer    r!   --jsonZcommandcmd)metavardestTZ	uninstall)nameZupgrade)r   add_argumentr   r	   Zadd_subparsersrequiredconfigure_parser_cleanconfigure_parser_compareconfigure_parser_configconfigure_parser_createconfigure_parser_infoconfigure_parser_initconfigure_parser_installconfigure_parser_listconfigure_parser_packageconfigure_parser_removeconfigure_parser_renameconfigure_parser_runconfigure_parser_searchconfigure_parser_updateconfigure_parser_notices)psub_parsers r=   7lib/python3.8/site-packages/conda/cli/conda_argparse.pygenerate_parser%   sV     r?   c                 C   sD   | j dd\}}ddlm} ||tddd }t||| |S )N.   r   )import_module)funcrsplit	importlibrB   __name__getattr)argsparserZrelative_modZ	func_namerB   moduler=   r=   r>   do_callW   s    rK   c                 C   s   t | jjd j S Nr   )tupleZ_subparsersZ_group_actionschoiceskeys)rI   r=   r=   r>   find_builtin_commands`   s    rP   c                       s<   e Zd Z fddZdd Z fddZ fddZ  ZS )	r   c                    sb   | dst|d< d|kr(d}d|d< nd}tt| j|| |rJt|  | jr^|  jd7  _d S )Nformatter_classadd_helpTFz

Options:
)getr   superr   __init__add_parser_helpr   )selfrH   kwargsZadd_custom_help	__class__r=   r>   rU   g   s    

zArgumentParser.__init__c                 C   s\   | j }|dkrdS |D ]@}d|j|kr2|  S |j|krD|  S |j|kr|  S qdS )zGiven a name, get the Action instance registered with this parser.
        If only it were made available in the ArgumentError object. It is
        passed as it's first arg...
        N/)Z_actionsr   option_stringsr'   r(   )rW   r)   Z	containerr    r=   r=   r>   _get_action_from_namew   s    

z$ArgumentParser._get_action_from_namec                    s   dd l }ddlm} t d }|rt|dr<| |j}nd }|r|jdkr|	d|j
}|r|d}|s|   td nR|d| }|sdd	lm}	 |	||d| g}
|
tjdd   t|
tj tt| | d S )
Nr   rA   )find_executableargument_namer&   zinvalid choice: u?'([-\w]*?)'zconda-r   )CommandNotFoundError)refind_commandsr^   sysexc_infohasattrr]   r_   r(   matchmessagegroup
print_helpexit
exceptionsr`   extendargv_execosenvironrT   r   error)rW   rg   ra   r^   excZargumentmr&   
executabler`   rH   rY   r=   r>   rq      s,    

zArgumentParser.errorc                    s   t t|   tjdd  g dgdgdgdgfkr~ddlm} | }|r~dg}|d |dd	 t|D  t	d

| d S )NrA    r!   -h--help)rb   z-conda commands available from other packages:c                 s   s   | ]}d | V  qdS )z  %sNr=   ).0r&   r=   r=   r>   	<genexpr>   s     z,ArgumentParser.print_help.<locals>.<genexpr>
)rT   r   ri   rc   rm   rb   appendrl   sortedprintr   )rW   rb   Zother_commandsZbuilderrY   r=   r>   ri      s    $
zArgumentParser.print_help)rF   
__module____qualname__rU   r]   rq   ri   __classcell__r=   r=   rY   r>   r   f   s   r   c                 C   s   t rtnt| |S N)on_win	_exec_win
_exec_unixexecutable_argsenv_varsr=   r=   r>   rn      s    rn   c              	   C   sN   t | |d}z.z|  W n tk
r6   |  Y nX W 5 t|j X d S )N)env)r   rc   rj   
returncodeZcommunicateKeyboardInterruptwait)r   r   r;   r=   r=   r>   r      s    r   c                 C   s   t | d | | d S rL   )ro   execvper   r=   r=   r>   r      s    r   c                   @   s"   e Zd Zedd ZdddZdS )NullCountActionc                 C   s*   t | |ttd fkr t| || t | |S r   )rG   r   setattr)	namespacer)   valuer=   r=   r>   _ensure_value   s    zNullCountAction._ensure_valueNc                 C   s&   |  || jdd }t|| j| d S )Nr   rA   )r   r(   r   )rW   rI   r   valuesoption_stringZ	new_countr=   r=   r>   __call__   s    zNullCountAction.__call__)N)rF   r~   r   staticmethodr   r   r=   r=   r=   r>   r      s   
r   c                       s(   e Zd Zd fdd	ZdddZ  ZS )	ExtendConstActionNFc
           
         s$   t  j||d|||||||	d
 d S )N*)
r\   r(   nargsconstdefaulttyperN   r+   r!   r'   )rT   rU   )
rW   r\   r(   r   r   r   rN   r+   r!   r'   rY   r=   r>   rU      s    zExtendConstAction.__init__c                 C   sJ   t || jd }|d krg n
|d d  }||p4| jg t|| j| d S r   )rG   r(   rl   r   r   )rW   rI   r   r   r   itemsr=   r=   r>   r      s    zExtendConstAction.__call__)NNNFNN)N)rF   r~   r   rU   r   r   r=   r=   rY   r>   r      s         r   c                 C   s   t d}t d}| jd|||d}|d}|jdddd	d
 |jddddd
 |jddddd
 |jddddd
 |jddddd
 |jddtjtdd |jddddd
 t| |jdd d S ) Nz,
    Remove unused packages and caches.
    z3
    Examples:

        conda clean --tarballs
    Zcleanr   r!   epilogzRemoval Targets-a--allr#   zDRemove index cache, lock files, unused cache packages, and tarballs.r$   -iz--index-cachezRemove index cache.-pz
--packageszRemove unused packages from writable package caches. WARNING: This does not check for packages installed using symlinks back to the package cache.z-tz
--tarballszRemove cached package tarballs.-fz--force-pkgs-dirszRemove *all* writable package caches. This option is not included with the --all flag. WARNING: This will break environments with packages installed using symlinks back to the package cache.-cz--tempfileszRemove temporary files that could not be deleted earlier due to being in-use.  Argument is path(s) to prefix(es) where files should be found and removed.)r   r    r!   -lz
--logfileszRemove log files.z.main_clean.executerC   )	r   
add_parseradd_argument_groupr*   rc   prefixr   add_output_and_prompt_optionsset_defaults)r<   descrexampler;   Zremoval_target_optionsr=   r=   r>   r,      sl    
     r,   c                 C   s   d}| j d||d}t| |jddttd |jdddd	d
 |jdddd
 |jddddd
 |jdddtd
 |jddddd
 |jddtdd |jdddd
 |jdddtd |jdd d S ) Nz0Display information about current conda install.infor   r!   	--offliner#   r    r   r!   r   r   zShow all information.r$   z--basezDisplay base environment path.-e--envsz"List all known conda environments.r   z	--licensez-s--systemzList environment variables.z--rootbaser    r!   r(   z--unsafe-channelsz-Display list of channels with tokens exposed.packagesstorer   r    r   r!   z.main_info.executer   )r   add_parser_jsonr*   r   r	   r   )r<   r!   r;   r=   r=   r>   r0   9  sx        r0   c           
   	   C   s  t dt }t dt }| jd|||d}t| |ddt }| }|jddd	t d
 |jdddt	
ddddtf d
 |jdddd
 |d}| }|jddd dd |jdddd
 |jdddd
 |jddd dd |jddd d
 |d!}| }	|	jd"ddd#d d$d% |	jd&d'd(d)g d*d% |	jd+d,d'd(d-g d*d% |	jd.d'd(d/g d*d% |	jd0d'd(d1g d*d% |	jd2d3d(d4g d$d% |	jd5dd6d
 |jd7d8dttd9 |jd:d; d S )<Nz
    Modify configuration values in .condarc.  This is modeled after the git
    config command.  Writes to the user .condarc file (%s) by default.

    a  
    See `conda config --describe` or %s/docs/config.html
    for details on all the options that can go in .condarc.

    Examples:

    Display all configuration values as calculated and compiled:

        conda config --show

    Display all identified configuration sources:

        conda config --show-sources

    Describe all available configuration options:

        conda config --describe

    Add the conda-canary channel:

        conda config --add channels conda-canary

    Set the output verbosity to level 3 (highest) for the current activate environment:

        conda config --set verbosity 3 --env

    Add the 'conda-forge' channel as a backup to 'defaults':

        conda config --append channels conda-forge

    Zconfigr   zConfig File Location SelectionzAWithout one of these flags, the user config file at '%s' is used.r   r#   z*Write to the system .condarc file at '%s'.r$   z--envzzWrite to the active conda environment .condarc file (%s). If no environment is active, write to the user config file (%s).ZCONDA_PREFIXz<no active environment>r   r   --filer   zWrite to the given file.zConfig Subcommandsz--showr   z~Display configuration values as calculated and compiled. If no arguments given, show information for all configuration values.)r   r   r!   z--show-sourcesz-Display all identified configuration sources.z
--validatez#Validate all configuration sources.z
--describezrDescribe given configuration parameters. If no arguments given, show information for all configuration parameters.z--write-defaultz`Write the default configuration to a file. Equivalent to `conda config --describe > ~/.condarc`.zConfig Modifiersz--getzGet a configuration value.KEY)r   r    r!   r   r'   z--appendr   r{   z5Add one configuration value to the end of a list key.)r   ZVALUEz	--prependz--addz;Add one configuration value to the beginning of a list key.z--setzSet a boolean or string keyz--removezZRemove a configuration value from a list key. This removes
    all instances of the value.z--remove-keyrA   z0Remove a configuration key (and all its values).z--stdinzIApply configuration information given in yaml format piped through stdin.r   --forcer   z.main_config.executer   )r   escaped_user_rc_pathr   r   r   r   add_mutually_exclusive_groupr*   escaped_sys_rc_pathro   getenvreplacer   r	   r   )
r<   r   Zadditional_descrr;   Zconfig_file_location_grouplocationZ_config_subcommandsZconfig_subcommandsZ_config_modifiersZconfig_modifiersr=   r=   r>   r.   x  s    
	

 	 r.   c                 C   s   d}|d }t d}| jd|||d}|jdddd	d
 t|dd\}}t| t| |jdddtd |jdtddtd |j	dd d S )NzBCreate a new conda environment from a list of specified packages. zTo use the created environment, use 'conda activate envname' to look in that directory first.  This command requires either the -n NAME or -p PREFIX option.z:
    Examples:

        conda create -n myenv sqlite

    Zcreater   z--cloner   z0Path to (or name of) existing local environment.ZENVr    r!   r'   T)prefix_required-m--mkdirr#   r$   --devUse `sys.executable -m conda` in wrapper scripts instead of CONDA_EXE. This is mainly for use during tests where we test new conda source against old Python versions.devr    r!   r(   r   z.main_create.executer   )
r   r   r*    add_parser_create_install_updateadd_parser_default_packagesadd_parser_experimental_solverr	   r   r   r   r<   r!   r   r   r;   solver_mode_optionspackage_install_optionsr=   r=   r>   r/   .  sF     
 	r/   c                 C   s  d}|}t d}| jd|||d}|jddttd |jddd	td |d
}|jddttd |jdddtd |jdddtd |jdddtd |jdddtd |jddddtt d t	r|jdddtd t
| |jddddd |jd d! d S )"Nz'Initialize conda for shell interaction.a9  
        Key parts of conda's functionality require that it interact directly with the shell
        within which conda is being invoked. The `conda activate` and `conda deactivate` commands
        specifically are shell-level commands. That is, they affect the state (e.g. environment
        variables) of the shell context being interacted with. Other core commands, like
        `conda create` and `conda install`, also necessarily interact with the shell environment.
        They're therefore implemented in ways specific to each shell. Each shell must be configured
        to make use of them.

        This command makes changes to your system that are specific and customized for each shell.
        To see the specific files and locations on your system that will be affected before, use
        the '--dry-run' flag.  To see the exact changes that are being or will be made to each
        location, use the '--verbose' flag.

        IMPORTANT: After running `conda init`, most shells will need to be closed and restarted for
        changes to take effect.

        Zinitr   r   r#   r    r!   r   r   z*Initialize all currently available shells.z
setup typez	--installz--userz0Initialize conda for the current user (default).z	--no-userstore_falsez6Don't initialize conda for the current user (default).r   z-Initialize conda for all users on the system.z	--reversez Undo past effects of conda init.Zshellsr   zOne or more shells to be initialized. If not given, the default value is 'bash' on unix and 'cmd.exe' on Windows. Use the '--all' flag to initialize all shells. Currently compatible shells are {%s}z, r   r!   z--anaconda-promptz.Add an 'Anaconda Prompt' icon to your desktop.-d	--dry-run'Only display what would have been done.r$   z.main_init.executer   )r   r   r*   r	   r   r   r   r|   r   r   r   r   )r<   r!   r   r   r;   Zsetup_type_groupr=   r=   r>   r1   \  s    (
	 r1   c                 C   s   d}t |d }t d}| jd|||d}|jdddd	d
 t|\}}t| t| |jddtdd t| |jddddd |jddtdd |jdtddtd |j	dd d S )Nz?Installs a list of packages into a specified conda environment.a  

    This command accepts a list of package specifications (e.g, bitarray=0.8)
    and installs a set of packages consistent with those specifications and
    compatible with the underlying environment. If full compatibility cannot
    be assured, an error is reported and the environment is not changed.

    Conda attempts to install the newest versions of the requested packages. To
    accomplish this, it may update some packages that are already installed, or
    install additional packages. To prevent existing packages from updating,
    use the --freeze-installed option. This may force conda to install older
    versions of the requested packages, and it does not prevent additional
    dependency packages from being installed.

    If you wish to skip dependency checking altogether, use the '--no-deps'
    option. This may result in an environment with incompatible packages, so
    this option must be used with great caution.

    conda can also be called with a list of explicit conda package filenames
    (e.g. ./lxml-3.2.0-py27_0.tar.bz2). Using conda in this mode implies the
    --no-deps option, and should likewise be used with great caution. Explicit
    filenames and package specifications cannot be mixed in a single command.
    z:
    Examples:

        conda install -n myenv scipy

    Zinstallr   z
--revisionr   z!Revert to the specified REVISION.ZREVISIONr   --force-reinstallr#   Ensure that any user-requested package for the current operation is uninstalled and reinstalled, even if that package already exists in the environment.r   r   r   z.Create the environment directory if necessary.r$   	--clobberZAllow clobbering of overlapping file paths within packages, and suppress related warnings.r   r   r   r   z.main_install.executer   )
r   r   r*   r   add_parser_pruner   r   add_parser_update_modifiersr   r   r   r=   r=   r>   r2     sZ     	r2   c                 C   s   d}t d}| jd||t|dd}t| t| t| t| |jdddd	d
 |jddddd
 |jdddd
 |jdddd
 |jddddd
 |jddddd
 |jdddddd |jddd d!d" |jd#d$ d S )%Nz,List linked packages in a conda environment.ar  
    Examples:

    List all packages in the current environment::

        conda list

    List all packages installed into the environment 'myenv'::

        conda list -n myenv

    Save packages for future use::

        conda list --export > package-list.txt

    Reinstall packages from an export file::

        conda create -n myenv --file package-list.txt

    listFr   r!   rQ   r   rR   r   --canonicalr#   z;Output canonical names of packages only. Implies --no-pip. r$   r   --full-namez,Only search for full names, i.e., ^<regex>$.z
--explicitzbList explicitly all installed conda packaged with URL (output may be used by conda create --file).z--md5z%Add MD5 hashsum when using --explicitr   z--exportzLOutput requirement string only (output may be used by  conda create --file).-rz--revisionsz#List the revision history and exit.z--no-pipr   TZpipz+Do not include pip-only installed packages.r    r   r(   r!   Zregexr   ?z4List only packages matching this regular expression.r   z.main_list.executer   )	r   r   r   rV   add_parser_prefixr   add_parser_show_channel_urlsr*   r   r<   r   Zexamplesr;   r=   r=   r>   r3   '  s|        r3   c                 C   sZ   d}t d}| jd||t|dd}t| t| t| |jdddd	 |jd
d d S )Nz,Compare packages between conda environments.a  
    Examples:

    Compare packages in the current environment with respect to 'environment.yml':

        conda compare environment.yml

    Compare packages installed into the environment 'myenv' with respect to 'environment.yml':

        conda compare -n myenv environment.yml

    ZcompareFr   filer   z;Path to the environment file that is to be compared againstr$   z.main_compare.executer   )r   r   r   rV   r   r   r*   r   r   r=   r=   r>   r-   z  s&    r-   c                 C   s   d}| j d||d}t| |jdddddd	d
 |jddddd |jddddd |jddddd |jddddd |jddddd |jdd d S )Nz/Low-level conda package utility. (EXPERIMENTAL)packager   z-wz--whichPATH+r   z=Given some PATH print which conda package the file came from.)r'   r   r    r!   r   z--resetr#   z$Remove all untracked files and exit.r$   z-uz--untrackedz%Display all untracked files and exit.z
--pkg-nameunknownz$Package name of the created package.r   z--pkg-versionz0.0z'Package version of the created package.z--pkg-buildr   z,Package build number of the created package.z.main_package.executer   )r   r   r*   r   )r<   r   r;   r=   r=   r>   r4     s\       r4   removec                 C   sH  d}t |d }t d}d}|dkrP| j|t||  ||  || dd}n| j|t|||| dd}t| t| t| t| |d}|j	d	d
d|  d |j	dd
d|  d |j	ddd
ddd |j	dd
dt
dd t| t| t| t| |j	ddddd| d |j	dtdd t
d! |jd"d# d S )$Nz9%s a list of packages from a specified conda environment.a{  

    This command will also remove any package that depends on any of the
    specified packages as well---unless a replacement can be found without
    that dependency. If you wish to skip this dependency checking and remove
    just the requested packages, add the '--force' option. Note however that
    this may result in a broken environment, so use this with caution.
    5
    Examples:

        conda %s -n myenv scipy

    zAlias for conda remove.r   F)rQ   r   r!   r   rR   Solver Mode Modifiersr   r#   z.%s all packages, i.e., the entire environment.r$   z
--featuresz"%s features (instead of packages).z--force-remover   zForces removal of a package without removing packages that depend on it. Using this option will usually leave your environment in a broken and inconsistent state.Zforce_remover   --no-pinignore_pinnedIgnore pinned file.r    r(   r   r!   Zpackage_namesZpackage_namer   r   z)Package names to %s from the environment.r'   r    r   r!   r   r   r   r   z.main_remove.executer   )r   r   r   
capitalizerV   add_parser_pscheckr   add_parser_channelsr   r*   r   r   r   add_parser_networkingr   r   r   )r<   r)   r!   r   r   Zuninstall_helpr;   r   r=   r=   r>   r5     s    

	


 
r5   c                 C   s   d}|t d }t d}| jd|||d}t| |jddtdd	td
 |jdtddtd
 |jdtddtd
 |jddt d |jdddddd |jdtdd |j	dd d S )Nz)Run an executable in a conda environment.z

    Example usage::

        $ conda create -y -n my-python-env python=3
        $ conda run -n my-python-env python --version
    
    runr   -v	--verbose:Use once for info, twice for debug, three times for trace.	verbosityr   r   zSets `CONDA_EXE` to `python -m conda`, assuming the CWD contains the root of conda development sources.  This is mainly for use during tests where we test new conda source against old Python versions.r   z--debug-wrapper-scriptszqWhen this is set, where implemented, the shell wrapper scriptswill echo to stderr a lot of debugging information.Zdebug_wrapper_scriptsz--cwdzACurrent working directory for command to run in.  Defaults to cwd)r!   r   z--no-capture-outputz--live-streamr#   zDon't capture stdout/stderr.Fr   Zexecutable_callzXExecutable name, with additional arguments to be passed to the executable on invocation.r   z.main_run.executer   )
r   r   r   r*   r   r   ro   getcwdr   r   )r<   r!   r   r   r;   r=   r=   r>   r7   )  sd     r7   c                 C   s   t d}t d}| jd|||d}|jdddd |jd	d
ddd |jdddddtd |jdddtd |jddtd |jdddtd |jddtd t| |jdddtd |jddtd |jddtd t| t| t| |j	dd d S ) NzSearch for packages and display associated information.
    The input is a MatchSpec, a query language for conda packages.
    See examples below.
    aB  
    Examples:

    Search for a specific package named 'scikit-learn':

        conda search scikit-learn

    Search for packages containing 'scikit' in the package name:

        conda search *scikit*

    Note that your shell may expand '*' before handing the command over to conda.
    Therefore it is sometimes necessary to use single or double quotes around the query.

        conda search '*scikit'
        conda search "*scikit*"

    Search for packages for 64-bit Linux (by default, packages for your current
    platform are shown):

        conda search numpy[subdir=linux-64]

    Search for a specific version of a package:

        conda search 'numpy>=1.12'

    Search for a package on a specific channel

        conda search conda-forge::numpy
        conda search 'numpy[channel=conda-forge, subdir=osx-64]'
    searchr   r   r#   zSearch all of the current user's environments. If run as Administrator (on Windows) or UID 0 (on unix), search all known environments on the system.r$   r   z--infoz0Provide detailed information about each package.z--subdirz
--platformr   ZsubdirzSearch the given subdir. Should be formatted like 'osx-64', 'linux-32', 'win-64', and so on. The default is to search the current platform.)r    r(   r!   r   Z
match_specr   r   )r   r   r!   r   r   r   z--names-onlyz-oz
--outdatedz--specz--reverse-dependencyz.main_search.executer   )
r   r   r*   r   r	   add_parser_knownr   r   r   r   )r<   r   r   r;   r=   r=   r>   r8   p  s        r8   updatec           	      C   s   d}t |d }t d}d}|dkr<| jd|||| d}n| j||||| d}t|\}}t| t| |jddtd	d
 t| |jddtdd
 |jdd d S )Nz8Updates conda packages to the latest compatible version.aU  

    This command accepts a list of package names and updates them to the latest
    versions that are compatible with all other packages in the environment.

    Conda attempts to install the newest versions of the requested packages. To
    accomplish this, it may update some packages that are already installed, or
    install additional packages. To prevent existing packages from updating,
    use the --no-update-deps option. This may force conda to install older
    versions of the requested packages, and it does not prevent additional
    dependency packages from being installed.
    r   zAlias for conda update.r  r   r   r#   r   r   r   r   z.main_update.executer   )	r   r   r   r   r   r*   r   r   r   )	r<   r)   r!   r   r   Z
alias_helpr;   r   r   r=   r=   r>   r9     sD    r9   z'Retrieves latest channel notifications.r   z

    Conda channel maintainers have the option of setting messages that
    users will see intermittently. Some of these notices are informational
    while others are messages concerning the stability of the channel.

    noticesc                 C   s@   t d| d| d}| j|tt|d}t| |jdd d S )Nz"
        Examples:

        conda z

        conda z -c defaults

        r   z.main_notices.executer   )r   r   NOTICES_DESCRIPTIONNOTICES_HELPr   r   )r<   r)   r   r;   r=   r=   r>   r:   %  s    
r:   )returnc                 C   s|   d}t d| d}t d}| jdt|||d}t| |jddd	 |jd
dddd |jdddddd |jdd d S )NzRenames an existing environmentz	
        z

        This command renames a conda environment via its name (-n/--name) or
        its prefix (-p/--prefix).

        The base environment and the currently-active environment cannot be renamed.
        z
        Examples:
            conda rename -n test123 test321
            conda rename --name test123 test321
            conda rename -p path/to/test123 test321
            conda rename --prefix path/to/test123 test321
        rename)rQ   r   r!   r   Zdestinationz"New name for the conda environment)r!   r   zForce rename of an environmentr#   F)r!   r    r   r   r   z&Only display what would have been donez.main_rename.executer   )r   r   r   r   r*   r   )r<   r!   r   r   r;   r=   r=   r>   r6   9  s@    
r6   Fc                 C   s   t | | t|  t| }t| }t|  t| }|jddtdd t| t	|  t
|  | jdg ddd | jd	d
dddd ||fS )Nz--download-onlyr#   zSolve an environment and ensure package caches are populated, but exit prior to unlinking and linking packages into the prefix.r   r   r{   zwRead package versions from the given file. Repeated file specifications can be passed (e.g. --file=file1 --file=file2).)r   r    r!   r   Zpackage_specr   r   z7Packages to install or update in the conda environment.r   )r   r   add_parser_solver_mode"add_parser_package_install_optionsr   r   r*   r   r   r   r  )r;   r   r   r   output_and_prompt_optionsr=   r=   r>   r   q  s:    
r   c                 C   s   | j ddtd d S )Nz--force-pscheckr#   r$   r*   r	   r;   r=   r=   r>   r     s
    r   c                 C   s*   | j dddtdd | j dddtd d S )	Nz--show-channel-urlsr#   Zshow_channel_urlszXShow channel urls. Overrides the value given by `conda config --show show_channel_urls`.r   z--no-show-channel-urlsr   r    r(   r!   r*   r   r	   r  r=   r=   r>   r     s    r   c                 C   s   | j ddtdd dS )z
    So we can use consistent capitalization and periods in the help. You must
    use the add_help=False argument to ArgumentParser or add_parser to use
    this. Add this first to be consistent with the default argparse output.

    rv   rw   z Show this help message and exit.r$   N)r*   r   r  r=   r=   r>   rV     s     rV   c                 C   sB   |  d}|j|d}|jdddddd |jd	d
dddd d S )Nz Target Environment Specification)r+   z-nz--namer   zName of environment.ZENVIRONMENTr   r   z--prefixz0Full path to environment location (i.e. prefix).r   )r   r   r*   )r;   r   Ztarget_environment_groupZnpgroupr=   r=   r>   r     s     
  r   c                 C   s\   |  d}|jddttd |jddtdd |jddtd	d
td |jdddtdd |S )N(Output, Prompt, and Flow Control Optionsr"   r#   r   r%   EReport all output as json. Suitable for using conda programmatically.r   r   r   r   r   -q--quietDo not display progress bar.r   r*   r   r	   r   r;   r
  r=   r=   r>   r     s:    
  r   c                 C   s   |  d}|jddttd |jddddd |jd	dtd
d |jdddtdd |jddtddtd |jdddtdd |S )Nr  r"   r#   r   r   r   r   r$   r%   r  r  r  r  r   r   zRCan be used multiple times. Once for INFO, twice for DEBUG, three times for TRACE.r   r   z-yz--yeszDo not ask for confirmation.r  r  r=   r=   r>   r     sT    
    r   c                 C   sV   |  d}|jdddddd |jdd	td
d |jdd	dd |jddddd |S )NzChannel Customizationr   z	--channelZchannelr{   a2  Additional channel to search for packages. These are URLs searched in the order
        they are given (including local directories using the 'file://'  syntax or
        simply a path like '/home/conda/mychan' or '../mychan').  Then, the defaults
        or channels from .condarc are searched (unless --override-channels is given).  You can use
        'defaults' to get the default packages for conda.  You can also use any name and the
        .condarc channel_alias value will be prepended.  The default channel_alias
        is https://conda.anaconda.org/.)r(   r    r!   z--use-localr#   z4Use locally built packages. Identical to '-c local'.r   z--override-channelsz@Do not search default or .condarc channels.  Requires --channel.r$   z--repodata-fnZrepodata_fnsa  Specify name of repodata on remote server. Conda will try whatever you specify, but will ultimately fall back to repodata.json if your specs are not satisfiable with what you specify here. This is used to employ repodata that is reduced in time scope.  You may pass this flag more than once.  Leftmost entries are tried first, and the fallback to repodata.json is added for you automatically.r  r   r*   r   )r;   Zchannel_customization_optionsr=   r=   r>   r     s4    
 r   c                 C   s   |  d}| }|jdddtddd |jdd	dttd
 |jdddtddd |jddtjddtd |jddtjddtd |jdd	dtdd
 |S )Nr   z--strict-channel-prioritystore_constZchannel_prioritystrictz|Packages in lower priority channels are not considered if a package with the same name appears in a higher priority channel.)r    r(   r   r   r!   z--channel-priorityr#   r   z--no-channel-priorityZdisabledz|Package version takes precedence over channel priority. Overrides the value given by `conda config --show channel_priority`.z	--no-depsZdeps_modifierzDo not install, update, remove, or change dependencies. This WILL lead to broken environments and inconsistent behavior. Use at your own risk.r    r   r(   r!   r   z--only-depszOnly install dependencies.r   r   r   )r   r   r*   r   r	   r   ZNO_DEPSZ	ONLY_DEPS)r;   r   Zdeps_modifiersr=   r=   r>   r  @  sb    
			r  c              	   C   s   |   }|jdddtjdtdd |jddtjdtdd |jd	d
dtjdtdd |jdddtjddtd |jddtjddtd d S )Nz--freeze-installedz--no-update-depsr  Zupdate_modifierz7Do not update or change already-installed dependencies.)r    r   r(   r   r!   z--update-depszUpdate dependencies.z-Sz--satisfied-skip-solvezExit early and do not run the solver if the requested specs are satisfied. Also skips aggressive updates as configured by 'aggressive_update_packages'. Similar to the default behavior of 'pip install'.z--update-allr   z1Update all installed packages in the environment.r  z--update-specsz(Update based on provided specifications.)	r   r*   r   ZFREEZE_INSTALLEDr   ZUPDATE_DEPSZSPECS_SATISFIED_SKIP_SOLVEZ
UPDATE_ALLZUPDATE_SPECS)r   Zupdate_modifiersr=   r=   r>   r   w  sX      
 r   c                 C   s   | j ddttd d S )Nz--pruner#   r   r  r  r=   r=   r>   r     s    r   c                 C   s"   | j dddd tD dtd dS )z
    Add a command-line flag for alternative solver backends.

    See ``context.experimental_solver`` for more info.

    TODO: This will be replaced by a proper plugin mechanism in the future.
    z--experimental-solverZexperimental_solverc                 S   s   g | ]
}|j qS r=   )r   )rx   vr=   r=   r>   
<listcomp>  s     z2add_parser_experimental_solver.<locals>.<listcomp>z1EXPERIMENTAL. Choose which solver backend to use.)r(   rN   r!   r   N)r*   r   r   r  r=   r=   r>   r     s    r   c                 C   sJ   |  d}|jdddddd |jdd	d
dtdd |jddtdd |S )NzNetworking Optionsz-Cz--use-index-cacher#   Fz9Use cache of channel index files, even if it has expired.r   z-kz
--insecurer   Z
ssl_verifyzoAllow conda to perform "insecure" SSL connections and transfers. Equivalent to setting 'ssl_verify' to 'false'.r   r   z,Offline mode. Don't connect to the Internet.r  )r;   Znetworking_optionsr=   r=   r>   r     s.    
  r   c                 C   s`   |  d}|jdddttd |jddtdd tr\|jddtd	td
 |jdddd	td
 |S )Nz(Package Linking and Install-time Optionsr   r   r#   r   z--copyzCInstall all packages using copies instead of hard- or soft-linking.z--shortcutsZ	shortcutsr   z--no-shortcutsr   z"Don't install start menu shortcuts)r   r*   r   r	   r   )r;   r   r=   r=   r>   r	    s<    
 r	  c                 C   s   | j ddddtd d S )Nz	--unknownr#   Fr   r   r  r  r=   r=   r>   r    s    r  c                 C   s   | j dddd d S )Nz--no-default-packagesr#   z4Ignore create_default_packages in the .condarc file.r$   )r*   r  r=   r=   r>   r     s
    r   )r   )r  )r  )F)F)YZ
__future__r   r   r   r   argparser   ZArgumentParserBaser   r   r	   r
   r   r   Zloggingr   ro   os.pathr   r   r   
subprocessr   rc   textwrapr   ru   r   Z
auxlib.ishr   Zbase.constantsr   r   r   r   r   Zcommon.constantsr   rF   logboolplatformr   Zuser_rc_pathr   r   r   r   r?   rK   rP   rn   r   r   r   r   r,   r0   r.   r/   r1   r2   r3   r-   r4   r5   r7   r8   r9   r  r  r:   r6   r   r   r   rV   r   r   r   r   r  r   r   r   r   r	  r  r   r=   r=   r=   r>   <module>   s~   $	2	K
'B? 7.{PS#.
^Gm
;
8
(
)(7.	 	