
    jVh                        d Z ddlmZ ddlZddlZddlmZ ej                  j                  e	      Z
d ZdZ G d d      Zej                  j                  d e              y)	z?Patches that are applied at runtime to the virtual environment.    )annotationsN)suppressc                ^    | j                   j                  fd}|| j                   _        y)a  
    Distutils allows user to configure some arguments via a configuration file:
    https://docs.python.org/3/install/index.html#distutils-configuration-files.

    Some of this arguments though don't make sense in context of the virtual environment files, let's fix them up.
    c                     | g|i |}| j                  d      }d|v r6t        t        j                  j	                  t
        j                        f|d<   dD ]  }d| }||v s|j                  |d          |S )Ninstallprefix)purelibplatlibheadersscriptsdatainstall_)get_option_dictVIRTUALENV_PATCH_FILEospathabspathsysr   pop)selfargskwargsresultr   basekeyold_parse_config_filess          ;/home/dcms/DCMS/lib/python3.12/site-packages/_virtualenv.pyparse_config_filesz&patch_dist.<locals>.parse_config_files   s    '>t>v>&&y1w 5rwwszz7R RGHH 	'DTF#Cg~C&	'     N)Distributionr   )distr   r   s     @r   
patch_distr"      s,     "..AA
 ,>D(r   )zdistutils.distzsetuptools.distc                  @    e Zd ZdZdZg ZddZed        Zed        Z	y)_FinderzGA meta path finder that allows patching the imported distutils modules.Nc           
        |t         v r-| j                   t        | j                        dk(  r/dd l}|j                         }| j                  j                  |       ddlm} ddl	m
} | j                  d   5  || _        	  |||      }|t        |j                  d      }	|	rdnd}
t        |j                  |
      }|	r| j                  n| j                  }||ur6t!        t"              5  t%        |j                  |
 |||             d d d        |d | _        cd d d        S 	 d | _        	 d d d        y y # 1 sw Y   .xY w# d | _        w xY w# 1 sw Y   y xY w)Nr   )partial)	find_specexec_moduleload_module)_DISTUTILS_PATCHfullnamelenlock	threadingLockappend	functoolsr&   importlib.utilr'   hasattrloadergetattrr(   r)   r   AttributeErrorsetattr)r   r+   r   targetr.   r-   r&   r'   spec
is_new_api	func_nameoldfuncs                r   r'   z_Finder.find_spec5   s9   ''DMM,A499~"  ~~' 		  &)01 ) ()$Xt4D'%,T[[-%H
5?M]	%dkk9=3=t//4CSCSd?!).!9 T 'Yc@R ST#$(DM) ) ( %)DM)  T T %)DM)  sC   9EA*E,D8	EE&E8E	=E	EEEc                P     | |       |j                   t        v rt        |       y y N__name__r*   r"   )r<   modules     r   r(   z_Finder.exec_moduleX   s#    F??..v /r   c                P     | |      }|j                   t        v rt        |       |S r?   r@   )r<   namerB   s      r   r)   z_Finder.load_module^   s%    T??..vr   r?   )
rA   
__module____qualname____doc__r+   r-   r'   staticmethodr(   r)    r   r   r$   r$   +   s?    QH
 D!F  
  r   r$   )rG   
__future__r   r   r   
contextlibr   r   join__file__r   r"   r*   r$   	meta_pathinsertrI   r   r   <module>rP      sW    E " 	 
 X. >6 7 8 8v   Q	 "r   