
    ;ȋhD.                        d Z ddlZddlZddlZddlZddlZddlZddlmZ ddl	m
Z
mZ ddlmZ ddlmZ ddlmZmZ d	d
lmZ d	dl	mZmZ d ZdZ G d dej                  Z G d de          ZdZdZdZd Zd ZdZ dS )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   )DistutilsExecErrorDistutilsPlatformError)
write_file)get_config_vars)LooseVersionsuppress_known_deprecation   )unix)CompileErrorErrorc                      g S )z6No longer needed, but kept for backward compatibility. r       e/var/www/pixelcanvas.ch/venv/lib/python3.11/site-packages/setuptools/_distutils/compilers/C/cygwin.py	get_msvcrr      s    Ir   zxUnable to set runtime library search path on Windows, usually indicated by `runtime_library_dirs` parameter to Extensionc                        e Zd ZdZdZdZdZdZdZdZ	dZ
dZd	Zd fd	Zed             Zd Z	 	 	 	 	 	 	 	 	 	 d fd	Zd Z fdZe fd            Z xZS )Compilerz9Handles the Cygwin port of the GNU C compiler to Windows.cygwinz.oz.az.dll.az.dllzlib%s%szcyg%s%sz.exeFc                    t                                          |||           t                      \  }}|                     d| d| d           |t          ur|                     d| d           t          dd          \  | _        | _        t          j
                            d| j        pd          | _        t          j
                            d| j        pd	          | _        | j        | _        | j        | _        d
}|                     | j         d| j         d| j         d| j         d| j         d| j         d| | j         d| j         d|            t                      | _        d S )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CXXgcczg++-sharedz -mcygwin -O -Wallz -mcygwin -mdll -O -Wallz	 -mcygwinz
 -mcygwin )compilercompiler_socompiler_cxxcompiler_so_cxx
linker_exe	linker_solinker_exe_cxxlinker_so_cxx)super__init__check_config_hdebug_printCONFIG_H_OKwarnr   cccxxosenvironget
linker_dlllinker_dll_cxxset_executablesr   dll_libraries)selfverbosedry_runforcestatusdetailsshared_option	__class__s          r   r&   zCompiler.__init__7   s   '5111(**NNNGNNNOOO$$IIO"O O O   ,D%88 *..tw'7%88:>>%):U;;'"h!3337<<< H888#xAAA',,,CCMCC"h111!0KKMKK 	 		
 		
 		
 '[[r   c                     t          j        dt          d           t                      5  t	          d          cd d d            S # 1 swxY w Y   d S )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	   )r4   s    r   gcc_versionzCompiler.gcc_version[   s     	X		
 	
 	
 	
 ()) 	* 	*))	* 	* 	* 	* 	* 	* 	* 	* 	* 	* 	* 	* 	* 	* 	* 	* 	* 	*s   AAAc                    |dv r>	 |                      dd|d|g           dS # t          $ r}t          |          d}~ww xY w	 |                     |          dk    r(|                      | j        |z   |d|gz   |z              dS |                      | j        |z   |d|gz   |z              dS # t          $ r}t          |          d}~ww xY w)z:Compiles the source by spawning GCC and windres if needed.).rc.reswindresz-iz-oNzc++)spawnr   r   detect_languager    r   )r4   objsrcextcc_argsextra_postargspp_optsmsgs           r   _compilezCompiler._compilej   s4   /!!(

ItS$<=====% ( ( ("3'''(('',,55JJ,!"c*+ ))     JJ(72c45EEV     & ( ( ("3'''(s0   " 
A ;A ?B- &B- -
C7CCNc                    t          j         |
pg           }
t          j         |pg           }t          j         |pg           }|r|                     t                     |                    | j                   ||| j        k    s| j        dk    rt          j        	                    |d                   }t          j        
                    t          j                            |                    \  }}t          j                            ||dz             }dt          j                            |           dg}|                    |           |                     t          ||fd|            |                    |           |	s|
                    d           t!                                          |||||||d|	|
|||           dS )	zLink the objects.Nr   r   z.defzLIBRARY EXPORTSzwriting z-s)copyr*   _runtime_library_dirs_msgextendr3   
EXECUTABLEr0   r-   pathdirnamesplitextbasenamejoinexecuter   appendr%   link)r4   target_descobjectsoutput_filename
output_dir	librarieslibrary_dirsruntime_library_dirsexport_symbolsdebugextra_preargsrL   
build_temptarget_langtemp_dirdll_namedll_extensiondef_filecontentsr;   s                      r   r]   zCompiler.link   s   $ 	-"5266Iio2..	)GMr** 	1II/000 	+,,, &4?**do.F.F wwqz22H(*(8(8  11) )%X}
 w||Hh.?@@H G27#3#3O#D#DFF	RHOON+++LLh%9;Ph;P;PQQQ
 NN8$$$  	'  &&& 	
 	
 	
 	
 	
r   c                 :    |                      t                     g S N)r*   rS   r4   dirs     r   runtime_library_dir_optionz#Compiler.runtime_library_dir_option   s     			+,,,	r   c                     t           j                            |          }t                                          |||          S rp   )r-   rV   normcaser%   _make_out_path)r4   ra   	strip_dirsrc_namenorm_src_namer;   s        r   rv   zCompiler._make_out_path   s4    ((22ww%%j)]KKKr   c                 L     i t                      j         fddD             S )z3
        Add support for rc and res files.
        c                 &    i | ]}||j         z   S r   )obj_extension).0rJ   r4   s     r   
<dictcomp>z+Compiler.out_extensions.<locals>.<dictcomp>   s#    HHHsC$,,HHHr   )rD   rC   )r%   out_extensions)r4   r;   s   `r   r   zCompiler.out_extensions   s9    

gg$
HHHHHHH
 	
r   FFF)
NNNNNFNNNN)__name__
__module____qualname____doc__compiler_typer|   static_lib_extensionshared_lib_extensiondylib_lib_extensionstatic_lib_formatshared_lib_formatdylib_lib_formatexe_extensionr&   propertyrA   rO   r]   rs   rv   r   __classcell__r;   s   @r   r   r   *   s8       CCMM# !! M") ") ") ") ") ")H * * X*( ( (: !V
 V
 V
 V
 V
 V
p  L L L L L
 
 
 
 
 X
 
 
 
 
r   r   c                   .     e Zd ZdZdZd fd	Zd Z xZS )MinGW32Compilerz:Handles the Mingw32 port of the GNU C compiler to Windows.mingw32Fc                 R   t                                          |||           d}t          | j                  rt	          d          |                     | j         d| j         d| j         d| j         d| j         | j         d| | j         | j         d|            d S )Nr   z1Cygwin gcc cannot be used with --compiler=mingw32z	 -O -Wallz -shared -O -Wall )r   r   r    r   r!   r"   r#   r$   )	r%   r&   is_cygwinccr+   r   r2   r,   r0   r1   )r4   r5   r6   r7   r:   r;   s        r   r&   zMinGW32Compiler.__init__   s    '5111!tw 	MKLLL***7555#x::: H///'|::=::"h=!0BB=BB 	 		
 		
 		
 		
 		
r   c                 *    t          t                    rp   )r   rS   rq   s     r   rs   z*MinGW32Compiler.runtime_library_dir_option  s    $%>???r   r   )r   r   r   r   r   r&   rs   r   r   s   @r   r   r      s^        DDM
 
 
 
 
 
&@ @ @ @ @ @ @r   r   okznot ok	uncertainc                     ddl m}  dt          j        v r	t          dfS dt          j        v r	t          dfS |                                 }	 t          j        |                              d          }d	}||v r
t          }d
}n	t          }d}||d| d|fS # t          $ r}t          d| d|j         fcY d}~S d}~ww xY w)aw  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   sysversionr)   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   r'   r'     s$   * $##### 888 #+::: 
	(	(	*	*BA<##--w-?? 	  D *!D 2@@0@@9@@@@  M M M"$Kb$K$KS\$K$KLLLLLLLMs   
(B 
B?!B:4B?:B?c                     t          t          j        |           dgz             }|                                                    d          S )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   J  s?    ek"oo0@@AAJ&&y111r   )!r   rR   r-   r   r   r   r?   
subprocessr   errorsr   r   	file_utilr   r   r   r   r	   r
    r   r   r   r   rS   r   r   r)   r   r   r'   r   get_versionsr   r   r   <module>r      s     				   



  # # # # # #        $ # # # # # ( ( ( ( ( ( ? ? ? ? ? ? ? ?               I F
 F
 F
 F
 F
t} F
 F
 F
T@ @ @ @ @h @ @ @@   .A .A .Ab2 2 2  r   