
    $TXg                         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 )+Nr   )dals)NULL   )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 environment '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}
m} ddlm}m} ddlm} dd	lm d
dlm}m} d
dlm} | j6                  s| j8                  s |d      |j:                  } |         ||      s |
|      | j6                  r||j<                  k(  r
d} ||      | j6                  r	 ||      ry| j6                  r||j>                  k(  r |d      tA        tC        |dd            s |	|      | jD                  stG        d| d       d| v r@ ||tI         ||      jK                               dddi       } ||      }	  |||| dd       |jL                  s:| jN                  s.| jD                  stQ        d| ddd        ||        ||       y| jR                  r(tI        fd tU        | j8                        D              }n || j8                        }d}d}|jV                  jY                         } |||||!      }|j[                         } |||| dd       y# |$ r | jD                  stG        d| d       Y w xY w)"Nr   )context)unregister_env)PrefixSetupUnlinkLinkTransaction)
PrefixData)CondaEnvironmentErrorCondaValueError"DirectoryNotACondaEnvironmentErrorEnvironmentLocationNotFoundPackagesNotFoundError)path_is_cleanrm_rf)is_conda_environment)	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_runc              3   0   K   | ]  } |         yw))track_featuresNrN   ).0frI   s     r6   	<genexpr>zexecute.<locals>.<genexpr>   s     W?V!)155?Vs   )specs_to_remove).base.contextr<   core.envs_managerr=   	core.linkr>   r?   core.prefix_datar@   
exceptionsrA   rB   rC   rD   rE   gateways.disk.deleterF   rG   gateways.disk.testrH   models.match_specrI   commonrJ   rK   installrL   allr!   rO   default_prefixroot_prefixr   r   jsonprinttupleiter_recordsrV   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   rG   rH   rJ   rK   rL   prefixmsgstptxnspecschannel_urlssubdirssolver_backendsolverrI   s                              @r6   executer}      sX   &2>-  <9-8#HH**<
 	

 ""F')&11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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   	reportersr	   	getLogger__name__logr7   intr}   rN   r8   r6   <module>r      sc   
  A A   "g!z"3 z. zzX) X^ X Xr8   