B heK@sdZddlZddlZddlZddlmZmZmZddlZddl m Z m Z ddl m Z ddlmZddlmZmZmZmZddlmZdd lmZdd lmZd d ZGd dde ZGdddeZdZdZdZ ddZ!e"dZ#ddZ$ddZ%ddZ&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)gen_preprocess_optionsgen_lib_options) UnixCCompiler) write_file)DistutilsExecErrorCCompilerError CompileErrorUnknownFileError)log) LooseVersion)find_executablecCstjd}|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)sysversionfind ValueError)Zmsc_posZmsc_verrsz get_versions..)tuple)Zcommandsrrrr's r'cCstddg}|dS)z>Try to determine if the gcc that would be used is from cygwin.rz -dumpmachinescygwin)rstripendswith)rirrrrQs rQ)'rOr<rr: subprocessrrrreZdistutils.ccompilerrrZdistutils.unixccompilerrZdistutils.file_utilrZdistutils.errorsr r r r rTr Zdistutils.versionrZdistutils.spawnrrrrPr%rWrZr$compilerbrkr'rQrrrrs0)     ;1+