
    wBf                     j    d Z ddlZddlmZmZmZ ddlmZ ddlmZ dedefd	Z	ed
edede
fd       Zy)zhCLI implementation for `conda-env update`.

Updates the conda environments with the specified packages.
    N)ArgumentParser	Namespace_SubParsersAction   )
CondaError)noticessub_parsersreturnc                 B   ddl m} ddlm}m}m} d}|} |d      } | j                  	 d|||d|}	 ||	       |	j                  dd	d
dd       |	j                  dddd       |	j                  ddd
d d        ||	        ||	       |	j                  d       |	S )Nr   dals   )add_parser_jsonadd_parser_prefixadd_parser_solverz9Update the current environment based on environment file.a  
        Examples::

            conda env update
            conda env update -n=foo
            conda env update -f=/path/to/environment.yml
            conda env update --name=foo --file=environment.yml
            conda env update vader/deathstar

        )helpdescriptionepilogz-fz--filestorez1environment definition (default: environment.yml)zenvironment.yml)actionr   defaultz--prune
store_trueFz8remove installed packages not defined in environment.yml)r   r   r   remote_definitionz0remote environment definition / IPython notebook?)r   r   r   nargsz!conda.cli.main_env_update.execute)func)update)	
auxlib.ishr   helpersr   r   r   
add_parseradd_argumentset_defaults)
r	   kwargsr   r   r   r   summaryr   r   ps
             9lib/python3.12/site-packages/conda/cli/main_env_update.pyconfigure_parserr'      s    !  JGK		F 				
 	A aNN@!   NNG	   NN?   AaNN;N<H    argsparserc                    ddl m} ddlm}m} ddlm} ddlm} ddl	m
}m} ddlm}	 ddlm}
m} dd	lm} |j'                  | j(                   || j*                        t-        j.                         | j0                  
      }|j2                  }| j(                  sb| j4                  sV|j(                  s9t,        j6                  j9                  dd      }|sd} |d      }||z  } |
|      |j(                  | _         |||       }i }|j:                  D ]  }	  |	|      ||<    d d d}|j:                  j?                         D ]!  \  }}||   }|jA                  ||| |      ||<   # |jB                  r# ||      }|jE                  |jB                          ||        || ||       y# |$ r t=         |dd dd d            w xY w)Nr   r   )contextdetermine_target_prefix)
PrefixData)specs)get_filenameprint_result)get_installer)CondaEnvExceptionInvalidInstaller)touch_nonadmin)namefilename	directoryr   CONDA_DEFAULT_ENVFz!Unable to determine environment

z
                    Please re-run this command with one of the following options:

                    * Provide an environment name via --name or -n
                    * Re-run this command inside an activated conda environment.
                    z3
                    Unable to install package for r   z.

                    Please double check and ensure you dependencies file has
                    the correct spelling.  You might also try installing the
                    conda-env-z\ package to see if provides the required
                    installer.
                    )condapip)#r   r   base.contextr,   r-   core.prefix_datar.   envr/   env.envr0   r1   env.installers.baser2   
exceptionsr3   r4   miscr5   detectr6   fileosgetcwdr   environmentprefixenvirongetdependenciesr   itemsinstall	variablesset_environment_env_vars)r)   r*   r   r,   r-   r.   install_specsr0   r1   r2   r3   r4   r5   specr>   r6   msginstuctionsrH   
installersinstaller_typeresultr/   	installerpds                            r&   executerY   M   s   !?-,43@%YYdii())+00	   D 

CIIxx ::>>"5u=D;" {"',,
 HH	$Wd3F J** 	)6~)FJ~&& D)F!$!1!1!7!7!9 M~.	!*!2!265$!L~M }}
##CMM26vv&9   	334# 6  !c "	 	s   F))G)__doc__rE   argparser   r   r    r   r   r'   intrY    r(   r&   <module>r_      sd   
 
   7"3 7. 7t 	V) V^ V V 	Vr(   