
    e                         d dl Z d dlZd dlZd dlmZmZmZmZ ej        	                    d          Z
ej        Ze
rdndZ eeee
rdnd          Z eeed          Zd	 Zd
 Zd Zd Z e            ZdS )    N)basenamedirnameexistsjoinwinScriptsbinz	conda.execondaz	conda.batc                  "    dd l } | j        j        S )Nr   )conda.configconfigroot_dir)r
   s    4lib/python3.11/site-packages/repo_cli/utils/conda.py_import_conda_rootr      s    <      c                      t           } t          r"t          t                     rt           nt          } t          |           sd} | S )Nr
   )	CONDA_EXEWINDOWSr   	CONDA_BAT)commands    r   _get_conda_exer      s>    G @%i00?))i'?? Nr   c                  :   t                      } | sd S 	 t          j        | ddgt          t          ot          j                                                d          }t          j        |          }|d         S # t          t          t          j        f$ r Y d S w xY w)Ninfoz--json)creationflagszutf-8root_prefix)r   
subprocesscheck_outputintr   CREATE_NO_WINDOWdecodejsonloads
ValueErrorKeyErrorCalledProcessError)r   output
conda_infos      r   _conda_root_from_conda_infor(   !   s    G t(fh'gE**EFF
 
 
 &// 	 Z''
-((*"?@   tts   A%A: :BBc                      	 t                      } nU# t          $ rH t          t                    }t	          |          dk    rt          |          } nt                      } Y nw xY w| S )zsGet the PREFIX of the conda installation.

    Returns:
        str: the ROOT_PREFIX of the conda installation
    envs)r   ImportErrorr   CONDA_PREFIXr   r(   )
conda_rootenvs_dirs     r   get_conda_rootr/   1   sy    7 ())

 
7 
7 
7<((H'' !**JJ 566J
7 s    AA#"A#)r!   r   sysos.pathr   r   r   r   platform
startswithr   prefixr,   BIN_DIRr   r   r   r   r(   r/   
CONDA_ROOT r   r   <module>r8      s         



 3 3 3 3 3 3 3 3 3 3 3 3
,
!
!%
(
(z
)))EDww(KGLL	Dw44	
! ! !	 	 	     4 ^


r   