
    wBf                     `    d Z ddlZddlZddlmZmZmZmZ ddlm	Z	 dedefdZ
ded	edefd
Zy)zaCLI implementation for `conda run`.

Runs the provided command within the specified environment.
    N)	REMAINDERArgumentParser	Namespace_SubParsersAction)	getLoggersub_parsersreturnc                    ddl m} ddlm} ddlm} ddlm}m} d}|} |d      }	 | j                  	 d|||	d	|}
 ||
        ||
       |
j                  d
|dd|       |
j                  d|dd|       |
j                  ddt        j                                |
j                  ddddd       |
j                  dt        d       |
j                  d       |
S ) N   )dals)NULL   )NullCountAction)add_parser_prefixadd_parser_verbosez)Run an executable in a conda environment.z
        Example::

        $ conda create -y -n my-python-env python=3
        $ conda run -n my-python-env python --version
        )helpdescriptionepilogz--devzSets `CONDA_EXE` to `python -m conda`, assuming the current working directory contains the root of conda development sources. This is mainly for use during tests where we test new conda sources against old Python versions.dev)actionr   destdefaultz--debug-wrapper-scriptszWhen this is set, where implemented, the shell wrapper scriptswill use the echo command to print debugging information to stderr (standard error).debug_wrapper_scriptsz--cwdzCurrent working directory for command to run in. Defaults to the user's current working directory if no directory is specified.)r   r   z--no-capture-outputz--live-stream
store_truez:Don't capture stdout/stderr (standard out/standard error).F)r   r   r   executable_callzXExecutable name, with additional arguments to be passed to the executable on invocation.)nargsr   zconda.cli.main_run.execute)func)run)
auxlib.ishr   common.constantsr   actionsr   helpersr   r   
add_parseradd_argumentosgetcwdr   set_defaults)r   kwargsr   r   r   r   r   summaryr   r   ps              2lib/python3.12/site-packages/conda/cli/main_run.pyconfigure_parserr,      s-   !'(>9GK	F 				
 	A aqNN'   	 NN!# %   NNM			   NNI   NN   NN4N5H    argsparserc                    ddl m} ddlm} ddlm} ddlm} ddlm	} ddl
m}  ||j                   ||j                        | j                  | j                  | j                   d	
      \  }}	 ||	 |t"        j$                  j'                               | j(                  d| j*                         }
| j*                  sb|
j,                  r%t/        |
j,                  t0        j,                         |
j2                  r%t/        |
j2                  t0        j2                         |
j4                  dk7  r=t7        t8              }|j;                  ddj=                  | j                          d       dt"        j$                  vr ||       |
j4                  S t7        t8              }|j?                  d|        |
j4                  S )Nr   )context)encode_environment)rm_rf)subprocess_call)wrap_subprocess_callr   )validate_prefixT)use_system_tmp_pathF)envpathraise_on_errorcapture_output)filer   z`conda run  z` failed. (See above for error)CONDA_TEST_SAVE_TEMPSz3CONDA_TEST_SAVE_TEMPS :: retaining main_run script ) base.contextr1   common.compatr2   gateways.disk.deleter3   gateways.subprocessr4   utilsr5   commonr6   root_prefixtarget_prefixr   r   r   r%   environcopycwdno_capture_outputstdoutprintsysstderrrcr   __name__errorjoinwarning)r.   r/   r1   r2   r3   r4   r5   r6   scriptcommandresponselogs               r+   executerX   X   sX   &2,5,' +--."" OFG rzz01XX111H !!??(//

3??(//

3 {{a!		#((4#7#7899XY	

 bjj0f
 ;; !I&RS;;r-   )__doc__r%   rM   argparser   r   r   r   loggingr   r,   intrX    r-   r+   <module>r^      sM   
 
 
 L L G"3 G. GT0) 0^ 0 0r-   