+
    kGj                        R t ^ RIt^ RIt^ RIt^ RIHt ^ RIHt ^ RI	H
t
 ^ RIHt ^ RIHt ]P                  R8H  t]! ]4      tRR R	 lltRR
 R lltRR R lltRR R lltRR R lltRR R lltRR R lltRR R lltR# )a  
Logic to place and find Python paths and EXTERNALLY-MANAGED in target (conda) environments.

Since functions in this module might be called to facilitate installation of the package,
this module MUST only use the Python stdlib. No 3rd party allowed (except for importlib-resources).
N)files)	getLogger)Path)check_output)Iteratorwin32c                D    V ^8  d   QhR\         P                  R\        /#    prefixreturnosPathLiker   )formats   "7lib/python3.14/site-packages/conda_pypi/python_paths.py__annotate__r      s     % %2;; %$ %    c                     \        T ;'       g    \        P                  4      p \        '       d
   V R ,          # V R,          R,          # )z
python.exebinpython)r   sysr   on_winr   s   &r   get_env_pythonr      s7    &&&CJJ'Fv$$E>H$$r   c                P    V ^8  d   QhR\         R\        P                  R\        /# )r
   keyr   r   )strr   r   r   )r   s   "r   r   r      s%     
 
 
bkk 
T 
r   c                    \        T;'       g    \        P                  4      p\        V4      \        P                  8X  g;   VP	                  4       \        \        P                  4      P	                  4       8X  d    \        \
        P                  ! V 4      4      # \        \        V4      R RV  R2.RR7      P                  4       pV'       g   \        RV  RV R24      h\        V4      # )z-cz)import sysconfig as s; print(s.get_path('z'))T)textz'Could not identify sysconfig path for 'z' at '')r   r   r   r   resolve	sysconfigget_pathr   r   stripRuntimeError)r   r   paths   && r   _get_env_sysconfig_pathr'      s    &&&CJJ'F
6{cjj FNN$4SZZ8H8P8P8R$RI&&s+,,		)RSVRWWZ'[\ eg 	 DSEPVxWXYZZ:r   c                D    V ^8  d   QhR\         P                  R\        /# r	   r   )r   s   "r   r   r   +   s     5 52;; 5$ 5r   c                     \        R V 4      # )stdlibr'   r   s   &r   get_env_stdlibr,   +   s    "8V44r   c                D    V ^8  d   QhR\         P                  R\        /# r	   r   )r   s   "r   r   r   /   s     6 6"++ 6 6r   c                     \        R V 4      # )purelibr+   r   s   &r   get_env_site_packagesr0   /   s    "9f55r   c                P    V ^8  d   QhR\         P                  R\        R\        /# r
   r   python_versionr   r   r   r   r   )r   s   "r   r   r   3   s+     Q Q QC Q[_ Qr   c                *   \        T ;'       g    \        P                  4      p Vf8   \        P                  P                   R\        P                  P
                   2p\        '       d   V R,          R,          # V R,          RV 2,          R,          # )zq
Returns the path for EXTERNALLY-MANAGED for the given Python installation in 'prefix'.
Not guaranteed to exist.
.LibEXTERNALLY-MANAGEDlibr   )r   r   r   version_infomajorminorr   )r   r3   s   &&r   get_externally_managed_pathr=   3   s    
 &&&CJJ'F ,,2231S5E5E5K5K4LM v~ 444~&(8 99<PPPr   c                D    V ^8  d   QhR\         P                  R\        /# r	   r   )r   s   "r   r   r   E   s     	9 	9 	9t 	9r   c                l    \        T ;'       g    \        P                  4      p \        V 4      R,          # )a7  
Returns the path for EXTERNALLY-MANAGED for the given Python installation in 'prefix'.
Not guaranteed to exist. There might be more EXTERNALLY-MANAGED files in 'prefix' for
older Python versions. These are not returned.

It assumes Python is installed in 'prefix' and will call it with a subprocess if needed.
r8   )r   r   r   r,   r   s   &r   #get_current_externally_managed_pathr@   E   s+     &&&CJJ'F&!$888r   c                Z    V ^8  d   QhR\         P                  R\        \        ,          /# r	   )r   r   r   r   )r   s   "r   r   r   Q   s"     = = = =r   c              #  6  "   \        T ;'       g    \        P                  4      p \        '       d   V R,          R,          x  R# \	        \        V R4      P                  R4      4       F)  pVP                  4       '       g   K  \        VR4      x  K+  	  R# 5i)z
Returns all the possible EXTERNALLY-MANAGED paths in 'prefix', for all found
Python (former) installations. The paths themselves are not guaranteed to exist.

This does NOT invoke python's sysconfig because Python  might not be installed (anymore).
r7   r8   r9   zpython*N)r   r   r   r   sortedglobis_dir)r   
python_dirs   & r   get_externally_managed_pathsrG   Q   sq      &&&CJJ'Fvun333 fe!4!9!9)!DEJ  "":';<< Fs   /BABBc                P    V ^8  d   QhR\         P                  R\        R\        /# r2   r4   )r   s   "r   r   r   a   s&      bkk # Y] r   c                2   \        W4      pVP                  4       '       gv   \        P                  RVP                  4       VP                  P                  RRR7       \        R4      R,          R,          pVP                  VP                  4       4       V# )z
conda-pypi places its own EXTERNALLY-MANAGED file when it is installed in an environment.
We also need to place it in _new_ environments created by conda. We do this by implementing
some extra plugin hooks.
z Placing EXTERNALLY-MANAGED in %sT)parentsexist_ok
conda_pypidatar8   )	r=   existsloggerinfoparentmkdirimportlib_files
write_text	read_text)r   r3   target_pathresources   &&  r   ensure_externally_managedrX   a   s}     .fEK68J8JK   ="<069<PPx1134r   )N)NN)__doc__r   r   r"   importlib.resourcesr   rS   loggingr   pathlibr   
subprocessr   typingr   platformr   __name__rO   r   r'   r,   r0   r=   r@   rG   rX    r   r   <module>rb      sl    
 
  8   # 		  
8	%
56Q$	9=  r   