Jd. @dZddlZddlZddlZddlZddlZddlZddlmZddl m Z ddl m Z ddl mZmZmZmZddlmZmZdd lmZejd gd gd gd gdgdgdgddgejd ZdZdZGdde ZGddeZdZdZdZ dZ!dZ"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) check_output) UnixCCompiler) write_file)DistutilsExecErrorDistutilsPlatformErrorCCompilerError CompileError) LooseVersionsuppress_known_deprecation)RangeMapmsvcr70msvcr71msvcr80msvcr90msvcr100msvcr110msvcr120ucrt vcruntime140) iiixii@iiilictjdtj} t |d}n#t $rYdSwxYw t|S#t$rtd|zwxYw)zaInclude the appropriate MSVC runtime library if Python was built with MSVC 7.0 or later. zMSC v\.(\d{4})rNzUnknown MS Compiler version %s ) researchsysversionintgroupAttributeError _msvcr_lookupKeyError ValueError)matchmsc_vers X/opt/alt/python311/lib/python3.11/site-packages/setuptools/_distutils/cygwinccompiler.py get_msvcrr%4s I' 5 5Eekk!nn%% FW%% FFF:WDEEEFs"A AA A##BzxUnable to set runtime library search path on Windows, usually indicated by `runtime_library_dirs` parameter to ExtensionceZdZdZdZdZdZdZdZdZ dZ dZ d Z dfd Z ed Zd Z ddZdZfdZefdZxZS)CygwinCCompilerz9Handles the Cygwin port of the GNU C compiler to Windows.cygwinz.oz.az.dll.az.dllzlib%s%szcyg%s%sz.exerc t|||t\}}|d|||t ur|d|ztj dd|_ tj dd|_ |j |_ d}| d|j zd |j zd|j zd |j zd |j | t|_dS) 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.CCgccCXXzg++-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_printformat CONFIG_H_OKwarnosenvirongetcccxx linker_dllset_executablesr% dll_libraries)selfverbosedry_runforcestatusdetails shared_option __class__s r$r5zCygwinCCompiler.__init__Vs7 '5111(**  3 : :67 K K     $ $ IIOQXY    *..u--:>>%//'!  +dg54tw>/$(:$tw.'..t NN    '[[ctjdtdt5t dcdddS#1swxYwYdS)Nzgcc_version attribute of CygwinCCompiler is deprecated. Instead of returning actual gcc version a fixed value 11.2.0 is returned.) stacklevelz11.2.0)warningsr:DeprecationWarningr r )rCs r$ gcc_versionzCygwinCCompiler.gcc_versionws   X      ( ) ) * *)) * * * * * * * * * * * * * * * * * *sAA A c*|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.reswindresz-iz-oN)spawnrr r0)rCobjsrcextcc_argsextra_postargspp_optsmsgs r$_compilezCygwinCCompiler._compiles %<<3&== ( ItS$<=====% ( ( ("3''' ( ( $w.#tS1AANR& ( ( ("3''' (s,* AAA &A44 B>B  BNctj| pg} tj|pg}tj|pg}|r|t||j|||jks |jdkrtj |d}tj tj |\}}tj ||dz}dtj |zdg}|D]}| ||t||fd|z| || s| dt!j||||||||d| | | | | dS) zLink the objects.Nr+rz.defz LIBRARY %sEXPORTSz writing %sz-s)copyr:_runtime_library_dirs_msgextendrB EXECUTABLEr@r;pathdirnamesplitextbasenamejoinappendexecuterrlink)rC target_descobjectsoutput_filename output_dir libraries library_dirsruntime_library_dirsexport_symbolsdebug extra_preargsr[ build_temp target_langtemp_dirdll_name dll_extensiondef_filecontentssyms r$rlzCygwinCCompiler.links$ -"5266 Iio2.. )GMr**  1 II/ 0 0 0 +,,,  & 4? * *do.F.Fwwqz22H(*(8(8  11)) %X} w||Hh.?@@H%rw'7'7'H'HH)TH% % %$$$$ LLh%9<(;R S S S NN8 $ $ $ '   & & &                  rKc:|tgSN)r:rbrCdirs r$runtime_library_dir_optionz*CygwinCCompiler.runtime_library_dir_options +,,, rKctj|}t|||Sr)r;renormcaser4_make_out_path)rCrp strip_dirsrc_name norm_src_namerJs r$rzCygwinCCompiler._make_out_paths4((22 ww%%j)]KKKrKcLitjfddDS)z3 Add support for rc and res files. c&i|] }||jzS) obj_extension).0rYrCs r$ z2CygwinCCompiler.out_extensions..s#HHHsC$,,HHHrK)rTrS)r4out_extensions)rCrJs`r$rzCygwinCCompiler.out_extensionss9  gg$ HHHHHHH  rKrrr) NNNNNrNNNN)__name__ __module__ __qualname____doc__ compiler_typerstatic_lib_extensionshared_lib_extensiondylib_lib_extensionstatic_lib_formatshared_lib_formatdylib_lib_format exe_extensionr5propertyrQr^rlrrr __classcell__rJs@r$r'r'Is,CCMM# !! M))))))B * *X *(((*!X X X X tLLLLL     X     rKr'c.eZdZdZdZdfd ZdZxZS)Mingw32CCompilerz:Handles the Mingw32 port of the GNU C compiler to Windows.mingw32rc >t|||d}t|jrt d|d|jzd|jzd|jzd|jzd|j|dS)Nr-z1Cygwin gcc cannot be used with --compiler=mingw32z %s -O -Wallz%s -mdll -O -Wallz%sz{} {}r.) r4r5 is_cygwinccr>r rAr?r8r@)rCrDrErFrIrJs r$r5zMingw32CCompiler.__init__s '5111! tw   V !TUU U "TW,+dg5&1dg~nnT_mDD      rKc*ttr)rrbrs r$rz+Mingw32CCompiler.runtime_library_dir_option s$%>???rKr)rrrrrr5rrrs@r$rr s^DDM      "@@@@@@@rKrokznot ok uncertaincddlm}dtjvr tdfSdtjvr tdfS|} t |} d|vr td|zf|Std |zf|S#|wxYw#t$r,}td ||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) sysconfigGCCzsys.version mentions 'GCC'Clangzsys.version mentions 'Clang'__GNUC__z'%s' mentions '__GNUC__'z '%s' does not mention '__GNUC__'zcouldn't read '{}': {}N) distutilsrrrr9get_config_h_filenameopenreadcloseCONFIG_H_NOTOKOSErrorCONFIG_H_UNCERTAINr8strerror)rfnconfig_hexcs r$r6r6-s4*$#####  888#+:::  ( ( * *B W88 X]]__,,"$>$CC NN    &'IB'NN NN    HNN     WWW"$<$C$CB $U$UVVVVVVVWsB C !B0;C  B0C 0CC C?!C:4C?:C?cttj|dgz}|dS)zCTry to determine if the compiler that would be used is from cygwin.z -dumpmachinescygwin)rshlexsplitstripendswith)r> out_strings r$rr\s?ek"oo0@@AAJ      & &y 1 11rK)$rr;rrrarrO subprocessr unixccompilerr file_utilrerrorsrrr r rr r _collectionsr leftundefined_valuerr%rbr'rr9rrr6r get_versionsrrKr$rs ######((((((!!!!!! >======="""""" kkkklll~&&# . F F F I } } } } } m} } } B@@@@@@@@<  ,W,W,W^222  rK