
    .Ph+                         d dl Z d dlmZ d dlmZmZmZ d dlmZ d dl	m
Z
mZ d dlmZmZmZmZ erd dlmZ dd	d
efdZdd	d
efdZdd	d
efdZdddddddddedededededee         dee         d
dfdZdS )    N)partial)TYPE_CHECKINGCallableOptional)Version)install_conda_exeinstall_micromamba)conda_executablesconda_standalone_executablesmamba_executablesmicromamba_executables)StrPathexer   returnc                 "   t          j        | dgd                                          }|                    d          D ]@}|                    d          r)t          |                                d                   c S At          |           S )a  Determine the version of mamba on the given executable.

    Typical output of `mamba --version` for v1 is:
    ```
    mamba 1.4.7
    conda 23.5.0
    ```

    Typical output of `mamba --version` for v2 is identical to micromamba:
    ```
    2.0.8
    ```
    	--versionutf-8encodingFkeependsmamba)
subprocesscheck_outputstrip
splitlines
startswithr   splitdetermine_micromamba_versionr   outlines      O/var/www/html/test/jupyter/venv/lib/python3.11/site-packages/ensureconda/api.pydetermine_mamba_versionr%      s     
!3"4w
G
G
G
M
M
O
OC.. - -??7## 	-4::<<+,,,,,	- (,,,    c                     t          j        | dgd                                          }|                    d          D ]*}t	          |                                d                   c S t	          d          S )Nr   r   r   Fr   r   0.0.0)r   r   r   r   r   r   r!   s      r$   r    r    )   st    

!3"4w
G
G
G
M
M
O
OC.. ) )tzz||B'(((((7r&   c                 "   t          j        | dgd                                          }|                    d          D ]@}|                    d          r)t          |                                d                   c S At          d          S )	Nr   r   r   Fr   condar   r(   )r   r   r   r   r   r   r   r!   s      r$   determine_conda_versionr+   0   s    

!3"4w
G
G
G
M
M
O
OC.. - -??7## 	-4::<<+,,,,,	-7r&   TF)r   
micromambar*   	conda_exe
no_installmin_conda_versionmin_mamba_versionr   r,   r*   r-   r.   r/   r0   zOptional[StrPath]c                    dddt           t                   dt          dgt          f         dt          fd}t	          ||t
                    }t	          ||t                    }	t	          ||t                    }
| r"t                      D ]}|r |	|          r|c S |rAt                      D ]}|r |
|          r|c S |st                      }| |
|          r|S |r"t                      D ]}|r ||          r|c S |rAt                      D ]}|r ||          r|c S |st                      }| ||          r|S dS )	a  Ensures that conda is installed

    Parameters
    ----------
    mamba:
        Allow resolving mamba
    micromamba:
        Allow resolving micromamba.  Micromamba implements a subset of features of conda su
        it may not be the correct choice in all cases.
    conda:
        Allow resolving conda.
    conda_exe
        Allow resolving conda-standalong
    min_conda_version:
        Minimum version of conda required
    min_mamba_version:
        Minimum version of mamba required

    Returns the path to a conda executable.
    
executabler   min_version
version_fnr   c                 (    |d u p ||           |k    S )N )r2   r3   r4   s      r$   version_constraint_metz+ensureconda.<locals>.version_constraint_metW   s#    
 t#OJ)?)?;)NOr&   )r3   r4   N)r   r   r   boolr   r+   r%   r    r   r   r	   r
   r   r   )r   r,   r*   r-   r.   r/   r0   r7   conda_constraints_metmamba_constraints_metmicromamba_constraints_metr   	maybe_exes                r$   ensurecondar=   8   s"   >PPg&P i['12P 
	P P P P $%*  
 $%*  
 ")%/" " "  $&& 	 	C ,,S11 


 !)++ 	 	C 11#66 


 	!*,,I$)C)CI)N)N$   $&& 	 	C ,,S11 


 !/11 	 	C ,,S11 


 	!)++I$)>)>y)I)I$  4r&   )r   	functoolsr   typingr   r   r   packaging.versionr   ensureconda.installerr   r	   ensureconda.resolver
   r   r   r   	_typeshedr   r%   r    r+   r8   r=   r6   r&   r$   <module>rD      s             4 4 4 4 4 4 4 4 4 4 % % % % % % G G G G G G G G             "!!!!!!- -w - - - -,i G     w     +/+/N N NN N 	N
 N N  (N  (N N N N N N Nr&   