
    ǆi.                     F   S r SSKrSSKrSSKrSSKrSSKrSSKrSSKrSSKJ	r	  SSK
Jr  SSKJrJrJrJr  SSKJr  SSKJr  SS	KJrJr  \R0                  " S
/S/S/S/S/S/S/S/\R2                  S.	5      rS rSr " S S\5      r " S S\5      rSrSr Sr!S r"S r#Sr$g)a  distutils.cygwinccompiler

Provides the CygwinCCompiler class, a subclass of UnixCCompiler that
handles the Cygwin port of the GNU C compiler to Windows.  It also contains
the Mingw32CCompiler class which handles the mingw32 port of GCC (same as
cygwin in no-cygwin mode).
    N)check_output   )RangeMap)CCompilerErrorCompileErrorDistutilsExecErrorDistutilsPlatformError)
write_file)UnixCCompiler)LooseVersionsuppress_known_deprecationmsvcr70msvcr71msvcr80msvcr90msvcr100msvcr110msvcr120vcruntime140)	i  i  ix  i  i@  i  i  il  i  c                      [         R                  " S[        R                  5      n  [	        U R                  S5      5      n [        U   $ ! [         a    / s $ f = f! [         a    [        SU S35      ef = f)zYInclude the appropriate MSVC runtime library if Python was built
with MSVC 7.0 or later.
zMSC v\.(\d{4})r   zUnknown MS Compiler version  )
researchsysversionintgroupAttributeError_msvcr_lookupKeyError
ValueError)matchmsc_vers     u/home/dmtnaga/Documents/work/airagagent/rag_env/lib/python3.13/site-packages/setuptools/_distutils/cygwinccompiler.py	get_msvcrr%   4   s~     II'5Eekk!n%DW%%  	  D7yBCCDs   A A AAA7zxUnable to set runtime library search path on Windows, usually indicated by `runtime_library_dirs` parameter to Extensionc                      ^  \ rS rSrSrSrSrSrSrSr	Sr
SrS	rS
rSU 4S jjr\S 5       rS r          SS jrS rU 4S jr\U 4S j5       rSrU =r$ )CygwinCCompilerI   z9Handles the Cygwin port of the GNU C compiler to Windows.cygwinz.oz.az.dll.az.dllzlib%s%szcyg%s%sz.exec           	      .  > [         TU ]  XU5        [        5       u  pEU R                  SU SU S35        U[        La  U R                  SU S35        [        R                  R                  SS5      U l	        [        R                  R                  SS	5      U l
        U R                  U l        S
nU R                  U R                   S3U R                   S3U R                   S3U R                   S3U R                   SU 3S9  [        5       U l        g )NzPython's GCC status: z (details: )zCPython's pyconfig.h doesn't seem to support your compiler. Reason: z>. Compiling may fail because of undefined preprocessor macros.CCgccCXXzg++-sharedz -mcygwin -O -Wallz -mcygwin -mdll -O -Wallz	 -mcygwinz
 -mcygwin compilercompiler_socompiler_cxx
linker_exe	linker_so)super__init__check_config_hdebug_printCONFIG_H_OKwarnosenvirongetcccxx
linker_dllset_executablesr%   dll_libraries)selfverbosedry_runforcestatusdetailsshared_option	__class__s          r$   r7   CygwinCCompiler.__init__V   s   51(*0G9ANO$II") $OO **..u-::>>%/''!y 2377)#;< HH:%78''),//**]OD 	 	
 '[    c                     [         R                  " S[        SS9  [        5          [	        S5      sS S S 5        $ ! , (       d  f       g = f)Nzgcc_version attribute of CygwinCCompiler is deprecated. Instead of returning actual gcc version a fixed value 11.2.0 is returned.   )
stacklevelz11.2.0)warningsr;   DeprecationWarningr   r   )rD   s    r$   gcc_versionCygwinCCompiler.gcc_versiont   s8     	X		
 ()) *))s	   :
Ac                    US;   a   U R                  SSUSU/5        g U R                  U R                  U-   USU/-   U-   5        g! [         a  n[        U5      eSnAff = f! [         a  n[        U5      eSnAff = f)z:Compiles the source by spawning GCC and windres if needed.).rc.reswindresz-iz-oN)spawnr   r   r2   )rD   objsrcextcc_argsextra_postargspp_optsmsgs           r$   _compileCygwinCCompiler._compile   s    /!(

ItS$<=(

$$w.#tS1AANR	 & ("3''( & ("3''(s.   A 'A% 
A"AA"%
A?/A::A?c                    [         R                   " U
=(       d    / 5      n
[         R                   " U=(       d    / 5      n[         R                   " U=(       d    / 5      nU(       a  U R                  [        5        UR                  U R                  5        UGb  XR
                  :w  d  U R                  S:X  a  [        R                  R                  US   5      n[        R                  R                  [        R                  R                  U5      5      u  nn[        R                  R                  XS-   5      nS[        R                  R                  U5       3S/nU H  nUR                  U5        M     U R                  [        UU4SU 35        UR                  U5        U	(       d  U
R                  S5        [         R"                  " U UUUUUUUSU	U
UUU5        g)	zLink the objects.Nr-   r   z.defzLIBRARY EXPORTSzwriting z-s)copyr;   _runtime_library_dirs_msgextendrC   
EXECUTABLErA   r<   pathdirnamesplitextbasenamejoinappendexecuter
   r   link)rD   target_descobjectsoutput_filename
output_dir	librarieslibrary_dirsruntime_library_dirsexport_symbolsdebugextra_preargsr^   
build_temptarget_langtemp_dirdll_namedll_extensiondef_filecontentssyms                       r$   rp   CygwinCCompiler.link   s   $ 		-"526IIio2.	))GMr*II/0 	++, &??*doo.F wwwqz2H(*(8(8  1)%X}
 ww||H.?@H #277#3#3O#D"EF	RH%$ &LLh%9XhZ;PQ
 NN8$   & 	
rM   c                 0    U R                  [        5        / $ N)r;   rf   rD   dirs     r$   runtime_library_dir_option*CygwinCCompiler.runtime_library_dir_option   s     			+,	rM   c                 b   > [         R                  R                  U5      n[        TU ]  XU5      $ r   )r<   ri   normcaser6   _make_out_path)rD   rt   	strip_dirsrc_namenorm_src_namerK   s        r$   r   CygwinCCompiler._make_out_path   s)    ((2w%j]KKrM   c                 d   > 0 [         TU ]  ES Vs0 s H  oXR                  -   _M     snE$ s  snf )z#
Add support for rc and res files.
)rW   rV   )r6   out_extensionsobj_extension)rD   r\   rK   s     r$   r   CygwinCCompiler.out_extensions   s@    

g$
8GHC,,,,H
 	
Hs   -)r?   r@   rC   rA   FFF)
NNNNNFNNNN)__name__
__module____qualname____firstlineno____doc__compiler_typer   static_lib_extensionshared_lib_extensiondylib_lib_extensionstatic_lib_formatshared_lib_formatdylib_lib_formatexe_extensionr7   propertyrS   ra   rp   r   r   r   __static_attributes____classcell__rK   s   @r$   r'   r'   I   s    CMM# !! M)< * *(* !X
tL
 
 
rM   r'   c                   :   ^  \ rS rSrSrSrSU 4S jjrS rSrU =r	$ )Mingw32CCompileri  z:Handles the Mingw32 port of the GNU C compiler to Windows.mingw32c           	        > [         TU ]  XU5        Sn[        U R                  5      (       a  [	        S5      eU R                  U R                   S3U R                   S3U R                   S3U R                   U R                   SU 3S9  g )Nr/   z1Cygwin gcc cannot be used with --compiler=mingw32z	 -O -Wallz -shared -O -Wallr   r0   )r6   r7   is_cygwinccr?   r   rB   r@   rA   )rD   rE   rF   rG   rJ   rK   s        r$   r7   Mingw32CCompiler.__init__  s    51!tww !TUUy	*77)#45 HH:Y/'')=/: 	 	
rM   c                      [        [        5      er   )r	   rf   r   s     r$   r   +Mingw32CCompiler.runtime_library_dir_option  s    $%>??rM    r   )
r   r   r   r   r   r   r7   r   r   r   r   s   @r$   r   r     s    DM
 @ @rM   r   okznot ok	uncertainc                     SSK Jn   S[        R                  ;   a  [        S4$ S[        R                  ;   a  [        S4$ U R                  5       n [        R                  " U5      R                  SS9nS	nX2;   a	  [        nS
nO[        nSnXA< SU SU< 34$ ! [         a"  n[        SU SUR                   34s SnA$ SnAff = f)aK  Check if the current Python installation appears amenable to building
extensions with GCC.

Returns a tuple (status, details), where 'status' is one of the following
constants:

- CONFIG_H_OK: all is well, go ahead and compile
- CONFIG_H_NOTOK: doesn't look good
- CONFIG_H_UNCERTAIN: not sure -- unable to read pyconfig.h

'details' is a human-readable string explaining the situation.

Note there are two ways to conclude "OK": either 'sys.version' contains
the string "GCC" (implying that this Python was built with GCC), or the
installed "pyconfig.h" contains the string "__GNUC__".
r   )	sysconfigGCCzsys.version mentions 'GCC'Clangzsys.version mentions 'Clang'zutf-8)encoding__GNUC__mentionszdoes not mentionr   zcouldn't read 'z': N)	distutilsr   r   r   r:   get_config_h_filenamepathlibPath	read_textCONFIG_H_NOTOKOSErrorCONFIG_H_UNCERTAINstrerror)r   fnconfig_h	substringcodemention_inflectedexcs          r$   r8   r8   )  s    * $ 888 #++::: 
	(	(	*BM<<#--w-?	 D *!D 2vQ019-@@@ M"obTS\\N$KLLMs   AB 
C"B?9C?Cc                     [        [        R                  " U 5      S/-   5      nUR                  5       R	                  S5      $ )zCTry to determine if the compiler that would be used is from cygwin.z-dumpmachines   cygwin)r   shlexsplitstripendswith)r?   
out_strings     r$   r   r   Y  s6    ekk"o0@@AJ&&y11rM   )%r   re   r<   r   r   r   r   rQ   
subprocessr   _collectionsr   errorsr   r   r   r	   	file_utilr
   unixccompilerr   r   r   r   leftundefined_valuer   r%   rf   r'   r   r:   r   r   r8   r   get_versionsr   rM   r$   <module>r      s     	  	  
  # "  " ( = kkkklll&&#.D I z
m z
|@ @:   -M`2 rM   