
    uc
                         d dl Z e j        d          dk    Zerd Znd Z	 d dlmZ dS # e$ r d dlZej        ej	        z  dfdZY dS w xY w)    N   c                     | S N ss    */usr/lib/python3/dist-packages/xdg/util.pyur
      s        c                 ,    |                      d          S )Nzutf-8)decoder   s    r	   r
   r
   
   s    xx   r   )whichc                 Z    d }t           j                                       r | |          r S dS |p)t           j                            dt           j                                      t           j                  }t          j	        dk    rt           j
        |vr |                    dt           j
                   t           j                            dd                              t           j                  }t           fd|D                       r g}n fd	|D             }n g}t                      }|D ]q}t           j                            |          }||vrL|                    |           |D ]4}	t           j                            ||	          }
 ||
|          r|
c c S 5rdS )
aK  Given a command, mode, and a PATH string, return the path which
        conforms to the given mode on the PATH, or None if there is no such
        file.

        `mode` defaults to os.F_OK | os.X_OK. `path` defaults to the result
        of os.environ.get("PATH"), or can be overridden with a custom search
        path.

        c                     t           j                            |           o4t          j        | |          ot           j                            |            S r   )ospathexistsaccessisdir)fnmodes     r	   _access_checkzwhich.<locals>._access_check    sD    GNN2&& .29R+>+> .GMM"---/r   NPATHwin32r   PATHEXT c              3      K   | ]=}                                                     |                                           V  >d S r   )lowerendswith.0extcmds     r	   	<genexpr>zwhich.<locals>.<genexpr>9   sA      HH399;;''		44HHHHHHr   c                     g | ]}|z   S r   r   r    s     r	   
<listcomp>zwhich.<locals>.<listcomp><   s    666ss666r   )r   r   dirnameenvirongetdefpathsplitpathsepsysplatformcurdirinsertanysetnormcaseaddjoin)r#   r   r   r   pathextfilesseendirnormdirthefilenames   `          r	   r   r      s   	/ 	/ 	/ 7??3 	}S$'' 
4:
vrz::AA"*MM<7""9$$Ary))) jnnY3399"*EEG
 HHHHHHHHH 76666g666 EEuu 	$ 	$Cg&&s++Gd??!!!$ $ $G7<<W55D$}T400 $#$tr   )
r-   version_infoPY3r
   shutilr   ImportErrorr   F_OKX_OKr   r   r	   <module>rC      s    



	qQ !   ! ! !> ; ; ;III"') 8 8 8 8 8 8 8;s   ( AA