+
     h  c                  s  a  0 t $ R t^ RIHt ^ RIt^ RIt^ RIt^ RIt^ RIH	t	H
t
Ht ^ RIt]	! R4      t]	! R]]P                   4      t. tR]R&    R t]R	 R
 l4       t]R R l4       tR R ltR R ltR tR tR tR tR# )z
Monkey patching of distutils.
)annotationsN)TypeVarcastoverload_T	_UnpatchTz	list[str]__all__c                s    \         P                  ! 4       R8X  d   V 3V P                  ,           # \        P                  ! V 4      # )aU  
Returns the bases classes for cls sorted by the MRO.

Works around an issue on Jython where inspect.getmro will not return all
base classes if multiple classes share the same name. Instead, this
function will return a tuple containing the class itself, and the contents
of cls.__bases__. See https://github.com/pypa/setuptools/issues/1024.
ZJython)platformZpython_implementationZ	__bases__inspectZgetmro)cls   &6/usr/lib/python3.14/site-packages/setuptools/monkey.py_get_mror      s5     %%'83v%%>>#    c                    V ^8  d   QhRRRR/# )   itemr   return Zformat   "r   __annotate__r   )   s     4 4	 4i 4r   c                    R # Nr   r   r
   r   get_unpatchedr   (   s    14r   c                    V ^8  d   QhRRRR/# )r   r   Zobjectr   ZNoner   r   r   r   r   r   +   s     , , ,4 ,r   c                r   r   r   r   r
   r   r   r   *   s    ),r   c               r   )r   r   z"type | types.FunctionType | objectr   z type | types.FunctionType | Noner   r   r   r   r   r   ,   s      
,%r   c                s    \        V \        4      '       d   \        V 4      # \        V \        P                  4      '       d   \        V 4      # R # r   )Z
isinstancetypeget_unpatched_classtypesFunctionTypeget_unpatched_functionr   r
   r   r   r   ,   s=     $"4(($**++%d++r   c               r   )r   r	   ztype[_T]r   r   r   r   r   r   r   6   s      X ( r   c                s    R \        V 4       4       p\        V4      pVP                  P                  R4      '       g   RV : 2p\	        V4      hV# )zProtect against re-patching the distutils if reloaded

Also ensures that no other distutils extension monkeypatched the distutils
first.
c              3  s   "   T FC  pVP                   P                  R 4      '       d   K&  \        \        \        ,          V4      x  KE  	  R# 5i)
setuptoolsN)
__module__
startswithr   r   r   )Z.0r	   s   & r   Z	<genexpr>Z&get_unpatched_class.<locals>.<genexpr><   s9       C~~((6 	T"Xs s
   #A#A	distutilsz&distutils has already been patched by )r   Znextr!   r"   ZAssertionError)r	   Zexternal_basesZbaseZmsgs   &   r   r   r   6   sR    C=N
 D??%%k226sg>S!!Kr   c                 s4   ^ RI p V P                  \        P                  n        \	        4        \        P
                  \        P                  \        P                  3 F  pV P
                  P                  Vn        K   	  V P                  P                  \        P                  n	        V P                  P                  \        P                  n	        R\        P                  9   d3   V P                  P                  \        P                  R,          n	        R# R# )i    Nzdistutils.command.build_ext)r    ZCommandr#   Zcore_patch_distribution_metadatadistZcmdZDistributionZ	extensionZ	ExtensionsysZmodules)r    Zmodules     r   	patch_allr'   H   s     (//INN " ..)..)--?(oo:: @  *33==INN$.$8$8$B$BI!$3 !**44 	)	

 4r   c                 s    ^RI Hp   R F2  p\        W4      p\        \        P
                  P                  W4       K4  	  R# )i   )_core_metadataN)Zwrite_pkg_infoZwrite_pkg_fileZread_pkg_fileZget_metadata_versionZget_fullname)Z r(   getattrsetattrr#   r%   ZDistributionMetadata)r(   ZattrZnew_vals      r   r$   r$   ]   s4     N ./	33TCr   c                sj    \        W4      p\        V 4      P                  RV4       \        WV 4       R# )z
Patch func_name in target_mod with replacement

Important - original must be resolved by name to avoid
patching an already patched function.
	unpatchedN)r)   ZvarsZ
setdefaultr*   )ZreplacementZ
target_modZ	func_nameZoriginals   &&& r   
patch_funcr,   l   s1     z-H 	  h7 J;/r   c                s    V P                   # r   )r+   )Z	candidater
   r   r   r   }   s    r   )__conditional_annotations__Z__doc__Z
__future__r    r   r   r&   r   Ztypingr   r   r   Zdistutils.filelistr#   r   r   r   r   r   Z__annotations__r   r   r   r'   r$   r,   r   )r-   s   @r   <module>r.      s    #   
  * * T]Ku'9'9:	   
 4 
 4	 , 
 ,$5*D0"r   