
    09oe0                         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mZ ddlm	Z	 ddl
mZ ddlmZmZmZmZ ddlmZmZ d Zd	Z G d
 de	          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)UnixCCompiler)
write_file)DistutilsExecErrorDistutilsPlatformErrorCCompilerErrorCompileError)LooseVersionsuppress_known_deprecationc                  h   t           j                            d          } | dk    rt           j        | dz   | dz            }|dk    rdgS |dk    rdgS |d	k    rd
gS |dk    rdgS |dk    rdgS |dk    rdgS |dk    rdgS dt          |          cxk    rdk     rn nddgS t	          d|z            dS )zaInclude the appropriate MSVC runtime library if Python was built
    with MSVC 7.0 or later.
    zMSC v.   
   1300msvcr701310msvcr711400msvcr801500msvcr901600msvcr1001700msvcr1101800msvcr120il  i  ucrtvcruntime140zUnknown MS Compiler version %s N)sysversionfindint
ValueError)msc_posmsc_vers     ^D:\Python Project\StaffProfile\venv\Lib\site-packages\setuptools/_distutils/cygwinccompiler.py	get_msvcrr(      s    kx((G"}}+gkGbL89f;;;;<<<S\\((((D(((((N++>HIII7 }    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dZd Z fdZe fd            Z xZS )CygwinCCompilerz9Handles the Cygwin port of the GNU C compiler to Windows.cygwinz.oz.az.dll.az.dllzlib%s%szcyg%s%sz.exer   c           
         t                                          |||           t                      \  }}|                     d                    ||                     |t
          ur|                     d|z             t          j        	                    dd          | _
        t          j        	                    dd          | _        | j
        | _        d}|                     d| j
        z  d	| j
        z  d| j        z  d
| j
        z  d                    | j        |                     t                      | _        d S )Nz%Python's GCC status: {} (details: {})zPython's pyconfig.h doesn't seem to support your compiler. Reason: %s. Compiling may fail because of undefined preprocessor macros.CCgccCXXzg++-sharedz%s -mcygwin -O -Wallz%s -mcygwin -mdll -O -Wallz%s -mcygwinz{} -mcygwin {}compilercompiler_socompiler_cxx
linker_exe	linker_so)super__init__check_config_hdebug_printformat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'   r9   zCygwinCCompiler.__init__Q   s7   '5111(**3::67KK	
 	
 	
 $$IIOQXY   *..u--:>>%//'!+dg54tw>/$(:$tw.'..tNN 	 	
 	
 	
 '[[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
   )rG   s    r'   gcc_versionzCygwinCCompiler.gcc_versionr   s     	X		
 	
 	
 	
 ()) 	* 	*))	* 	* 	* 	* 	* 	* 	* 	* 	* 	* 	* 	* 	* 	* 	* 	* 	* 	*s   AAAc                 *   |dk    s|dk    r>	 |                      dd|d|g           dS # t          $ r}t          |          d}~ww xY w	 |                      | 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-oN)spawnr   r	   r4   )rG   objsrcextcc_argsextra_postargspp_optsmsgs           r'   _compilezCygwinCCompiler._compile   s    %<<3&==(

ItS$<=====% ( ( ("3'''((

$w.#tS1AANR     & ( ( ("3'''(s,   * 
AAA&A4 4
B>BB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                            |          z  dg}|D ]}|                    |           |                     t          ||fd|z             |                    |           |	s|
                    d           t!          j        | |||||||d|	|
|||           dS )	zLink the objects.Nr/   r   z.defz
LIBRARY %sEXPORTSz
writing %sz-s)copyr>   _runtime_library_dirs_msgextendrF   
EXECUTABLErD   r?   pathdirnamesplitextbasenamejoinappendexecuter   r   link)rG   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'   ro   zCygwinCCompiler.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 %rw'7'7'H'HH)TH% % %$$$$LLh%9<(;RSSS
 NN8$$$  	'  &&& 	
 	
 	
 	
 	
r)   c                 :    |                      t                     g S N)r>   re   rG   dirs     r'   runtime_library_dir_optionz*CygwinCCompiler.runtime_library_dir_option   s     			+,,,	r)   c                     t           j                            |          }t                                          |||          S r   )r?   rh   normcaser8   _make_out_path)rG   rs   	strip_dirsrc_namenorm_src_namerN   s        r'   r   zCygwinCCompiler._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  )obj_extension).0r\   rG   s     r'   
<dictcomp>z2CygwinCCompiler.out_extensions.<locals>.<dictcomp>   s#    HHHsC$,,HHHr)   )rW   rV   )r8   out_extensions)rG   rN   s   `r'   r   zCygwinCCompiler.out_extensions   s9    

gg$
HHHHHHH
 	
r)   r   r   r   )
NNNNNr   NNNN)__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_extensionr9   propertyrT   ra   ro   r   r   r   __classcell__rN   s   @r'   r+   r+   D   s,       CCMM# !! M) ) ) ) ) )B * * X*( ( (* !X
 X
 X
 X
t  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 )Mingw32CCompilerz:Handles the Mingw32 port of the GNU C compiler to Windows.mingw32r   c           
      r   t                                          |||           d}t          | j                  rt	          d          |                     d| j        z  d| j        z  d| j        z  d| j        z  d                    | j        |                     g | _	        t                      | _	        d S )Nr1   z1Cygwin gcc cannot be used with --compiler=mingw32z%s -O -Wallz%s -mdll -O -Wallz%sz{} {}r2   )r8   r9   is_cygwinccrB   r   rE   rC   r<   rD   rF   r(   )rG   rH   rI   rJ   rM   rN   s        r'   r9   zMingw32CCompiler.__init__
  s    '5111!tw 	V !TUUU"TW,+dg5&1dg~nnT_mDD 	 	
 	
 	
   '[[r)   c                 *    t          t                    r   )r   re   r   s     r'   r   z+Mingw32CCompiler.runtime_library_dir_option&  s    $%>???r)   r   )r   r   r   r   r   r9   r   r   r   s   @r'   r   r     s^        DDM) ) ) ) ) )8@ @ @ @ @ @ @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          |          }	 d|                                v r t          d|z  f|                                 S t          d	|z  f|                                 S # |                                 w xY w# t          $ r,}t          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'__GNUC__z'%s' mentions '__GNUC__'z '%s' does not mention '__GNUC__'zcouldn't read '{}': {}N)	distutilsr   r    r!   r=   get_config_h_filenameopenreadcloseCONFIG_H_NOTOKOSErrorCONFIG_H_UNCERTAINr<   strerror)r   fnconfig_hexcs       r'   r:   r:   3  s4   * $##### 888 #+::: 
	(	(	*	*B
W88	X]]__,,"$>$CC NN &'IB'NNNNHNN W W W"$<$C$CB$U$UVVVVVVVWsB   
C	 !B0 ;C	 B0 C	 0CC	 	
C?!C:4C?:C?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)rB   
out_strings     r'   r   r   b  s?    ek"oo0@@AAJ&&y111r)   )r   r?   r    rd   r   rR   
subprocessr   distutils.unixccompilerr   distutils.file_utilr   distutils.errorsr   r   r   r	   distutils.versionr
   r   r(   re   r+   r   r=   r   r   r:   r   get_versionsr   r)   r'   <module>r      s    
			 



    # # # # # # 1 1 1 1 1 1 * * * * * *            G F F F F F F F J  J  JHI }
 }
 }
 }
 }
m }
 }
 }
B"@ "@ "@ "@ "@ "@ "@ "@R   ,W ,W ,W^2 2 2  r)   