
    wBf:
                         d Z ddlZddlZddlZddlZddlmZ ddlmZm	Z	m
Z
mZ ddlmZ d
dZ ed      d
d	       Zy)z9Utilities for finding executables and `conda-*` commands.    N)	lru_cache)basename
expanduserisfilejoin   )on_winc                    |rddl m}  |       g}t        j                  |d   k7  r|j	                  t        j                         |D cg c]*  }t        |t        t        j                  d                  , c}a	t        rt        j	                  d       ng a	t        j                  t        j                  j                  dd      j                  t        j                                t        D ]]  }t        r(dD ]"  }t        || |z         }t#        |      s|c c S  1t        ||       }t#        t%        |            sRt%        |      c S  y c c}w )	Nr   sys_prefix_unfollowedr   scriptsC:\cygwin\binPATH )z.exez.batr   )utilsr   sysprefixappendr   r   	sysconfigget_path	dir_pathsr	   extendosenvirongetsplitpathsepr   r   )
executableinclude_othersr   prefixespdir_pathextpaths           7lib/python3.12/site-packages/conda/cli/find_commands.pyfind_executabler&      s    1)+,::!$OOCJJ'OWX!T!Xi&8&8&CDEX	./	RZZ^^FB/55bjjAB 	(+  Hj3&67$<K 
 *-Dj&'!$''	( ' Ys   
/E)maxsizec                    | rddl m}  |       g}t        j                  |d   k7  r|j	                  t        j                         |D cg c]*  }t        |t        t        j                  d                  , }}t        r|j	                  d       ng }|j                  t        j                  j                  dd      j                  t        j                               t        rt!        j"                  d      }nt!        j"                  d	      }t%               }|D ]l  }	 t        j&                  |      D ]Q  }|j)                  |j*                        }	|	s!|j-                         s2|j/                  |	j1                  d
             S n t;        t=        |            S c c}w # t2        t4        t6        t8        f$ r Y w xY w)Nr   r   r   r   r   r   r   zconda-([\w\-]+)(\.(exe|bat))?$zconda-([\w\-]+)$   )r   r   r   r   r   r   r   r   r   r	   r   r   r   r   r   r   recompilesetscandirmatchnameis_fileaddgroupFileNotFoundErrorNotADirectoryErrorPermissionErrorOSErrortuplesorted)
r   r   r    r!   r   patresr"   entryms
             r%   find_commandsr=   /   s\   1)+,::!$OOCJJ'OWX!T!Xi&8&8&CDEX	X./	RZZ^^FB/55bjjABjj:;jj,-
%C 	H- (IIejj)GGAGGAJ'( 9 Y* "#5P 	 	s$   
/F!"5F&F&)"F&&GG)T)__doc__r   r*   r   r   	functoolsr   os.pathr   r   r   r   common.compatr	   r&   r=        r%   <module>rD      sB    @ 	 	 
   6 6 "@ 4# #rC   