
    wBf                         d Z ddlZddlmZmZmZ ddlmZmZ ddl	m
Z
  ej                  e      Zdedefd	Zd
ededefdZy)zeCLI implementation for `conda remove`.

Removes the specified packages from an existing environment.
    N)ArgumentParser	Namespace_SubParsersAction)isfilejoin   )
confirm_ynsub_parsersreturnc                    ddl m} ddlm} ddlm} ddlm}m}m	}m
}m}	m}
m} d} |d| d	      } |d
      } | j                  	 d*|||d|} |
|        ||        ||       |j                  d      }|j!                  ddd       |j!                  ddddd       |j!                  ddd|d        |	|        ||        ||        ||       |j!                  ddd       |j!                  ddd       |j!                  ddd d!d"#       |j!                  d$|d%d&|'       |j#                  d()       |S )+N   )dals)NULLr   )NullCountAction)add_output_and_prompt_optionsadd_parser_channelsadd_parser_networkingadd_parser_prefixadd_parser_pruneadd_parser_pscheckadd_parser_solverz>Remove a list of packages from a specified conda environment. z	
        a  

        Use `--all` flag to remove all packages and the environment itself.

        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.
        a  
        Examples:

        Remove the package 'scipy' from the currently-active environment::

            conda remove scipy

        Remove a list of packages from an environemnt 'myenv'::

            conda remove -n myenv scipy curl wheel

        Remove all packages from environment `myenv` and the environment itself::

            conda remove -n myenv --all

        Remove all packages from the environment `myenv` but retain the environment::

            conda remove -n myenv --all --keep-env

        )helpdescriptionepilogzSolver Mode Modifiersz
--features
store_truez&Remove features (instead of packages).)actionr   z--force-removez--forcezForces 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.force_remove)r   r   destz--no-pinignore_pinnedzIgnore pinned package(s) that apply to the current operation. These pinned packages might come from a .condarc file or a file in <TARGET_ENVIRONMENT>/conda-meta/pinned.)r   r   defaultr   z--allz2Remove all packages, i.e., the entire environment.z
--keep-envz@Used with `--all`, delete all packages but keep the environment.package_namespackage_namestore*z-Package names to remove from the environment.)metavarr   nargsr   z--devzUse `sys.executable -m conda` in wrapper scripts instead of CONDA_EXE. This is mainly for use during tests where we test new conda sources against old Python versions.dev)r   r   r   r    zconda.cli.main_remove.execute)func)remove)
auxlib.ishr   common.constantsr   actionsr   helpersr   r   r   r   r   r   r   
add_parseradd_argument_groupadd_argumentset_defaults)r
   kwargsr   r   r   r   r   r   r   r   r   r   summaryr   r   psolver_mode_optionss                    5lib/python3.12/site-packages/conda/cli/main_remove.pyconfigure_parserr7      s   !'(   OG			 		
	K 	F. 				
 	A qa../FG$$5 % 
 $$  %  $$2 %  ())*!!!$NNA  
 NNO  
 NN<   NN'    NN7N8H    argsparserc                    ddl m} ddlm} ddlm}m} ddlm} ddl	m
}m}m}	m}
 ddlm}m} ddlm d	d
lm}m} d	dlm} | j0                  s| j2                  s |d      |j4                  } |        | j0                  r||j6                  k(  r
d} ||      | j0                  r	 ||      ry| j0                  r||j8                  k(  r |d      t;        t=        |dd            s |	|      | j>                  stA        d| d       d| v r@ ||tC         ||      jE                               dddi       } ||      }	  |||| dd       |jF                  s<| jH                  s0| j>                  stK        d| ddd        ||d        ||       y| jL                  r(tC        fd tO        | j2                        D              }n || j2                        }d}d}|jP                  jS                         } |||||!      }|jU                         } |||| dd       y# |
$ r | j>                  stA        d| d       Y w xY w)"Nr   )context)unregister_env)PrefixSetupUnlinkLinkTransaction)
PrefixData)CondaEnvironmentErrorCondaValueError"DirectoryNotACondaEnvironmentErrorPackagesNotFoundError)path_is_cleanrm_rf)	MatchSpecr   )check_non_adminspecs_from_args)
handle_txnzHno package names supplied,
       try "conda remove -h" for more detailszHcannot remove current environment. deactivate and run conda remove againr   z?cannot remove root environment, add -n NAME or -p PREFIX optionz
conda-metahistoryz$
Remove all packages in environment z:
r!    )target_prefixunlink_precs
link_precsremove_specsupdate_specsneutered_specsFTzNo packages found in z . Continuing environment removalz)Everything found within the environment (zu), including any conda environment configurations and any non-conda files, will be deleted. Do you wish to continue?
no)r    dry_run)clean_empty_parentsc              3   0   K   | ]  } |         yw))track_featuresNrL   ).0frG   s     r6   	<genexpr>zexecute.<locals>.<genexpr>   s     W!)155Ws   )specs_to_remove)+base.contextr<   core.envs_managerr=   	core.linkr>   r?   core.prefix_datar@   
exceptionsrA   rB   rC   rD   gateways.disk.deleterE   rF   models.match_specrG   commonrH   rI   installrJ   allr!   rM   default_prefixroot_prefixr   r   jsonprinttupleiter_recordsrT   keep_envr	   featuressetplugin_managerget_cached_solver_backendsolve_for_transaction)r9   r:   r<   r=   r>   r?   r@   rA   rB   rC   rD   rE   rF   rH   rI   rJ   prefixmsgstptxnspecschannel_urlssubdirssolver_backendsolverrG   s                            @r6   executer{      sG   &2>-  <-8#HH**<
 	

 ""FxxFg444X#C((xxM&) xxW((('Q  d6<;<4V<<yy9&EFd"$":f#5#B#B#DE!C (,C3eT: ==yyCF8  LB  C $ %
 f$7v& ==Ws4CUCU?VWWE#D$6$67E //IIKguU**,3eT2; ) yy/x7WXs   H' ' I
	I
)__doc__loggingargparser   r   r   os.pathr   r   rc   r	   	getLogger__name__logr7   intr{   rL   r8   r6   <module>r      sc   
  A A   g!z"3 z. zz`) `^ ` `r8   