Vc?csdZddlZddlZddlZddlmZmZmZddlZddl m Z ddl m Z ddl mZmZmZmZddlmZddlmZd ZGd d e ZGd d eZdZdZdZdZejdZdZdZ dZ!dS)adistutils.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)PopenPIPE check_output) UnixCCompiler) write_file)DistutilsExecErrorCCompilerError CompileErrorUnknownFileError) LooseVersion)find_executablecstjd}|dkrYtj|dz|dz}|dkrdgS|dkrdgS|d krd gS|d krd gS|d krdgStd|zdS)zaInclude the appropriate MSVC runtime library if Python was built with MSVC 7.0 or later. zMSC v.iii Z1300Zmsvcr70Z1310Zmsvcr71Z1400Zmsvcr80Z1500Zmsvcr90Z1600Zmsvcr100zUnknown MS Compiler version %s N)sysversionZfindZ ValueError)Zmsc_posZmsc_ver 2/usr/lib64/python3.11/distutils/cygwinccompiler.py get_msvcrr=skx((G"}J+gai 23 f  J;    J;    J;    J;    J< >HII I%JJcsTeZdZdZdZdZdZdZdZdZ dZ dd Z d Z dd Z ddZd S)CygwinCCompilerz? Handles the Cygwin port of the GNU C compiler to Windows. Zcygwinz.o.az.dllzlib%s%sz%s%sz.exerc stj||||t\}}|d|d|d|tur|d|zt \|_|_|_ ||j d|jd|jd|j dz|jd krd |_ nd |_ |jd krd }nd}| dddd|j d||jdkrdg|_ |ddSt|_ dS)NzPython's GCC status: z (details: z)zPython's pyconfig.h doesn't seem to support your compiler. Reason: %s. Compiling may fail because of undefined preprocessor macros.z: gcc z, ld z , dllwrap z z2.10.90gccdllwrap2.13-shared -mdll -staticzgcc -mcygwin -O -Wallzgcc -mcygwin -mdll -O -Wallzg++ -mcygwin -O -Wallz gcc -mcygwinz -mcygwin Zcompiler compiler_soZ compiler_cxxZ linker_exeZ linker_so2.91.57Zmsvcrtz,Consider upgrading to a newer version of gcc)r__init__check_config_hZ debug_print CONFIG_H_OKZwarn get_versions gcc_version ld_versionZdllwrap_version compiler_type linker_dllset_executables dll_librariesr)selfverbosedry_runforceZstatusZdetails shared_options rrzCygwinCCompiler.__init__bstWgu===(**  &&'''+ , , ,  $  IIO    NN @$/4+? ++***///.../00 2 2 2 ?i ' (#DOO'DO ?f $ ,%MM+M &=)F*A(6)---)I  K K K  y ( -!)zD  II> @ @ @ @ @ "+D   rcs*|dks|dkr> |dd|d|gdS#t$r}t|d}~wwxYw ||j|z|d|gz|zdS#t$r}t|d}~wwxYw)z:Compiles the source by spawning GCC and windres if needed..rc.resZwindresz-iz-oN)Zspawnrrr)r&ZobjZsrcextZcc_argsextra_postargsZpp_optsZmsg r_compilezCygwinCCompiler._compiles %< (3&= ( ( ItS$<=====% ( ( ("3''' ( ( 4+g5dC8HH)*+++++% ( ( ("3''' (s,* AAA &A44 B>B  BNcstj| pg} tj|pg}tj|pg}||j|r||jks |jdkr[t j|d}t jt j |\}}t j ||dz}t j |d|zdz}dt j |zdg}|D]}| || t||fd |z|jd kr/| d |g| d |gn| || s| d tj||||||||d| | | | | dS)zLink the objects.Nrrz.defZlibrz LIBRARY %sZEXPORTSz writing %srz --output-libz--defz-s)copyZextendr%Z EXECUTABLEr#ospathZdirnamesplitextbasenamejoinappendZexecuterrlink)r&Z target_descZobjectsZoutput_filename output_dirZ librariesZ library_dirsZruntime_library_dirsZexport_symbolsZdebugZ extra_preargsr.Z build_tempZ target_langZtemp_dirZdll_nameZ dll_extensionZdef_fileZlib_fileZcontentsZsyms rr8zCygwinCCompiler.links+  -"5266 Iio2.. )GMr** +,,,( ) DO +( )/3%/G( )wwqz22H(*(8(8  11)3)3 %X}w||Hh.?@@Hw||Heh.>.EFFHrw//@@@H& % %$$$$ LLh%9%0 2 2 2 )+ )$$nh%?@@@$$gx%89999 x((( '   & & &4g%y,/ -&  ( ( ( ( (rcs$|d}g}|D]}tjtj|\}}||jddgzvrt d|d|d|rtj|}|dvr?|tj|||z|j z|tj|||j z|S) z#Adds supports for rc and res files.Nr:r+r,zunknown file type 'z ' (from 'z'))r,r+) r2r3r4ZnormcaseZsrc_extensionsr r5r7r6 obj_extension)r&Zsource_filenamesZ strip_dirr9Z obj_namesZsrc_nameZbaser-r/robject_filenamesz CygwinCCompiler.object_filenamessI  J ( K KH(()9)9()C)CDDID#4.%?@ '&&ssHHH(&''' /w''..o% K  "',,z.2Sj4;M.M#O#OPPPP  "',,z/3d6H/H#J#JKKKKrrrr) NNNNNrNNNN)rr:)__name__ __module__ __qualname____doc__r"r;Zstatic_lib_extensionZshared_lib_extensionZstatic_lib_formatZshared_lib_formatZ exe_extensionrr0r8r<rrrrWsMM!!M9-9-9-9-v ( ( (FJEI9=?CJ(J(J(J(\rrcseZdZdZdZddZdS)Mingw32CCompilerz@ Handles the Mingw32 port of the GNU C compiler to Windows. Zmingw32rc s<t|||||jdkrd}nd}|jdkrd}nd}t rt d|dd d d |jd |d | g|_t|_dS)Nrrrrz--entry _DllMain@12r:z1Cygwin gcc cannot be used with --compiler=mingw32z gcc -O -Wallzgcc -mdll -O -Wallz g++ -O -Wallrz r) rrr!r is_cygwingccrr$r#r%r)r&r'r(r)r*Z entry_points rrzMingw32CCompiler.__init__s  $%@@@ ?f $ ,%MM+M  y ( /KKK >> E CEE E n)=*8(-+/???MMM+6;(8  9 9 9'[[rNr=)r>r?r@rAr"rrBrrrCrCs7M&)&)&)&)&)&)rrCZokznot okZ uncertaincsddlm}dtjvr tdfS|} t |} d|vr td|zf|Std|zf|S#|wxYw#t$r}td|d |j fcYd }~Sd }~wwxYw) awCheck 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) sysconfigZGCCzsys.version mentions 'GCC'Z__GNUC__z'%s' mentions '__GNUC__'z '%s' does not mention '__GNUC__'zcouldn't read 'z': N) Z distutilsrEr r rZget_config_h_filenameZopenreadcloseCONFIG_H_NOTOKZOSErrorCONFIG_H_UNCERTAINZstrerror)rEZfnZconfig_hZexcs rrrFs%*$#####  9888  ( ( * *B ?88 X]]__, O"$>$CC NN    &'IB'NN NN    HNN     ???"",.BB =? ? ? ? ? ? ??sAB2!B$B29 BB2B//B22 C<CCCs(\d+\.\d+(\.\d+)*)cs|d}t|dSt|dtj} |}|n#|wxYwt|}|dSt| d S)zFind the version of an executable by running `cmd` in the shell. If the command is not found, or the output does not match `RE_VERSION`, returns None. rNT)Zshellstdouti) Zsplitr rrrJrFrG RE_VERSIONZsearchr ZgroupZdecode)cmdZ executableZout out_stringZresults r_find_exe_versionrNss QJz""t 4 - - - 4CXXZZ     z * *F t  Q..00 1 11s A22Bcs<gd}td|DS)zg Try to find out the versions of gcc, ld and dllwrap. If not possible it returns None for it. )zgcc -dumpversionzld -vzdllwrap --versioncs,g|]}t|SrB)rN)Z.0rLrrz z get_versions..s!===S#C((===r)Ztuple)Zcommands rrrs- BAAH ==H=== > >>rcsrtddg}|dS)z>Try to determine if the gcc that would be used is from cygwin.rz -dumpmachinescygwin)rZstripZendswith)rMrOrrDrDs4un566J      & &y 1 11r)"rAr2r r1Z subprocessrrrZreZdistutils.unixccompilerrZdistutils.file_utilrZdistutils.errorsrrrr Zdistutils.versionr Zdistutils.spawnr rrrCrrHrIrZcompilerKrNrrDrBrrrPs^ 0000000000 111111******((((((((((((******++++++JJJ4wwwwwmwwwt+)+)+)+)+)+)+)+)b  )?)?)?VRZ. / / 222*???22222r