B ‘–Re*Bã@sâdZddlZddlZddlZddlmZmZmZddlZddl m Z ddl m Z ddl mZmZmZmZddlmZddlmZd d „ZGd d „d e ƒZGd d„deƒZdZdZdZdd„Ze d¡Zdd„Zdd„Z dd„Z!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)ÚPopenÚPIPEÚ check_output)Ú UnixCCompiler)Ú write_file)ÚDistutilsExecErrorÚCCompilerErrorÚ CompileErrorÚUnknownFileError)Ú LooseVersion)Úfind_executablecCs€tj d¡}|dkr|tj|d|d…}|dkr8dgS|dkrFdgS|d krTd gS|d krbd gS|d krpdgStd|ƒ‚dS)zaInclude the appropriate MSVC runtime library if Python was built with MSVC 7.0 or later. zMSC v.éÿÿÿÿéé Z1300Zmsvcr70Z1310Zmsvcr71Z1400Zmsvcr80Z1500Zmsvcr90Z1600Zmsvcr100zUnknown MS Compiler version %s N)ÚsysÚversionÚfindÚ ValueError)Zmsc_posZmsc_ver©rú›/builddir/build/BUILDROOT/alt-python37-setuptools-58.3.0-4.el8.x86_64/opt/alt/python37/lib/python3.7/site-packages/setuptools/_distutils/cygwinccompiler.pyÚ get_msvcr?s rc @sReZdZdZdZdZdZdZdZdZ dZ dd d „Z d d „Z ddd„Z ddd„ZdS)ÚCygwinCCompilerz? Handles the Cygwin port of the GNU C compiler to Windows. Úcygwinz.oz.az.dllzlib%s%sz%s%sz.exercCsHt ||||¡tƒ\}}| d||f¡|tk rB| d|¡tj dd¡|_ tj dd¡|_ d|j krÎt ƒ\|_ |_ |_| |jd|j |j |jf¡|j dkr²|j |_nd |_|j d krÈd }qÚd }n |j |_d }|jd |j d|j d |j d|j d|j|fdd|j kr<|j dkrrrrÚobject_filenamess      z CygwinCCompiler.object_filenames)rrr) NNNNNrNNNN)rrW)Ú__name__Ú __module__Ú __qualname__Ú__doc__r0rYZstatic_lib_extensionÚshared_lib_extensionZstatic_lib_formatZshared_lib_formatZ exe_extensionr#rArLr\rrrrrYs @ Krc@seZdZdZdZddd„ZdS)ÚMingw32CCompilerz@ Handles the Mingw32 port of the GNU C compiler to Windows. Zmingw32rc Cs¨t ||||¡d|jkr*|jdkr*d}nd}d|jkrH|jdkrHd}nd}t|jƒr^tdƒ‚|jd |jd |jd |jd |jd |j ||fd g|_ t ƒ|_ dS)Nrz2.13z -mdll -staticz-sharedz2.91.57z--entry _DllMain@12rWz1Cygwin gcc cannot be used with --compiler=mingw32z %s -O -Wallz%s -mdll -O -Wallz%sz%s %s %s)rrrr r!) rr#r+r/r.Ú is_cygwinccrr2r,r1r3r)r4r5r6r7r:Ú entry_pointrrrr#s&   zMingw32CCompiler.__init__N)rrr)r]r^r_r`r0r#rrrrrbsrbÚokznot okZ uncertainc Cs®ddlm}dtjkrtdfSdtjkr0tdfS| ¡}y@t|ƒ}z(d| ¡kr\td|fStd |fSWd |  ¡XWn0t k r¨}zt d ||j ffSd }~XYnXd S) 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'ZClangzsys.version mentions 'Clang'Z__GNUC__z'%s' mentions '__GNUC__'z '%s' does not mention '__GNUC__'Nzcouldn't read '%s': %s) Ú distutilsrfrrr&Úget_config_h_filenameÚopenÚreadÚCONFIG_H_NOTOKÚcloseÚOSErrorÚCONFIG_H_UNCERTAINÚstrerror)rfÚfnÚconfig_hÚexcrrrr$Ms      r$s(\d+\.\d+(\.\d+)*)cCsl| ¡d}t|ƒdkrdSt|dtdj}z | ¡}Wd| ¡Xt |¡}|dkrZdSt |  d¡  ¡ƒS)z¤Find 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)ÚshellÚstdouté) Úsplitr rrrtrjrlÚ RE_VERSIONÚsearchr ÚgroupÚdecode)ÚcmdÚ executableÚoutÚ out_stringÚresultrrrÚ_find_exe_version~s     r€cCsdddg}tdd„|DƒƒS)zg Try to find out the versions of gcc, ld and dllwrap. If not possible it returns None for it. zgcc -dumpversionzld -vzdllwrap --versioncSsg|] }t|ƒ‘qSr)r€)Ú.0r{rrrú ™sz get_versions..)Útuple)Úcommandsrrrr-“s r-cCst|dgƒ}| ¡ d¡S)zCTry to determine if the compiler that would be used is from cygwin.z -dumpmachinescygwin)rÚstripÚendswith)r+r~rrrrc›s rc)"r`r(rrCÚ subprocessrrrÚreZdistutils.unixccompilerrÚdistutils.file_utilrÚdistutils.errorsrrr r Zdistutils.versionr Údistutils.spawnr rrrbr&rkrnr$Úcompilerwr€r-rcrrrrÚs,+    @1/