
    %dz                         d dl mZ d dlZd dlZd dlZd dlmZmZ d dl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 d	d
lmZmZ ddlmZ ddlmZmZ dZdZd Zed             Z dS )    )RawDescriptionHelpFormatterN)contextdetermine_target_prefix)add_parser_jsonadd_parser_prefixadd_parser_solver)
PrefixData)CondaEnvException)touch_nonadmin)notices   )print_resultget_filename   )specs)InvalidInstallerget_installerz:
Update the current environment based on environment file
z
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
c                    |                      dt          t          t          t                    }t	          |           |                    ddddd           |                    d	d
dd           |                    dddd d           t          |           t          |           |                    d           d S )Nupdate)formatter_classdescriptionhelp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.main_update.execute)func)	
add_parserr   r   exampler   add_argumentr   r   set_defaults)sub_parsersps     9lib/python3.11/site-packages/conda_env/cli/main_update.pyconfigure_parserr)   %   s    3 	 	 	A aNNh@!	     NNG	     NN?     AaNN.N/////    c                    t          j        | j        t          | j                  t          j                    | j                  }|j        }| j        sv| j	        so|j        s\t
          j
                            dd          }|s:d}|t          j        d                                          z  }t          |          |j        | _        t!          t"          |           }i }|j        D ]}}	 t'          |          ||<   # t(          $ r[ t*          j                            t          j        d                                                              |                     Y  dS w xY wd d d}	|j                                        D ](\  }}
||         }|                    ||
| |          |	|<   )|j        r)t9          |          }|                    |j                   t=          |           t?          | ||	           d S )	N)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.a8  
                Unable to install package for {0}.

                Please double check and ensure you dependencies file has
                the correct spelling.  You might also try installing the
                conda-env-{0} package to see if provides the required
                installer.
                )condapip) install_specsdetectr,   r   fileosgetcwdr   environmentprefixenvirongettextwrapdedentlstripr
   r   r   dependenciesr   r   sysstderrwriteformatitemsinstall	variablesr	   set_environment_env_varsr   r   )argsparserspecenvr,   msgr9   
installersinstaller_typeresultr   	installerpds                r(   executerR   F   s0   Ydi(()++0	  D 
CI  x 	- :>>"5u==D -;x (T U U V\U[U]U]	^ (,,,
 H	$Wd33F J*  	)6~)F)FJ~&& 
	 
	 
	JX_ .   VXXff^44   222
	 D))F!$!1!7!7!9!9 M M~.	!*!2!265$!L!L~
} 3
##CM2226vv&&&&&s   +C>>A E#"E#)!argparser   r6   r@   r<   conda.base.contextr   r   conda.cli.conda_argparser   r   r   conda.core.prefix_datar	   conda.exceptionsr
   
conda.miscr   conda.noticesr   commonr   r    r   r3   installers.baser   r   r   r#   r)   rR    r*   r(   <module>r^      sR   1 0 0 0 0 0 				 



  ? ? ? ? ? ? ? ?         
 . - - - - - . . . . . . % % % % % % ! ! ! ! ! ! . . . . . . . . % % % % % % = = = = = = = =0 0 0B 	C' C' 	C' C' C'r*   