7ec@sdZdZddlZddlZddlZddlmZmZddlm Z ddl m Z ddl m Z mZmZddlmZd Zd e fd YZd efd YZdZdZdZdZdZdZdS(sdistutils.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). s$Id$iN(tgen_preprocess_optionstgen_lib_options(t UnixCCompiler(t write_file(tDistutilsExecErrort CompileErrortUnknownFileError(tlogcCstjjd}|dkrtj|d|d!}|dkrIdgS|dkr\dgS|d krod gS|d krd gStd |ndS(saInclude the appropriate MSVC runtime library if Python was built with MSVC 7.0 or later. sMSC v.iii t1300tmsvcr70t1310tmsvcr71t1400tmsvcr80t1500tmsvcr90sUnknown MS Compiler version %s N(tsystversiontfindt ValueError(tmsc_postmsc_ver((s1/usr/lib64/python2.7/distutils/cygwinccompiler.pyt get_msvcr;s     tCygwinCCompilerc BseZdZdZdZdZdZdZdZddddZ d Z d d d d d dd d d d d Z dd d Z RS(tcygwins.os.as.dllslib%s%ss%s%ss.exeic CsStj||||t\}}|jd||f|tk r\|jd|nt\|_|_|_ |j|j d|j|j|j f|jdkrd|_ n d|_ |jdkrd}nd }|j d d d d dddddd|j |f|jdkrCdg|_ |jdn t|_ dS(Ns%Python's GCC status: %s (details: %s)sPython's pyconfig.h doesn't seem to support your compiler. Reason: %s. Compiling may fail because of undefined preprocessor macros.s: gcc %s, ld %s, dllwrap %s s2.10.90tgcctdllwraps2.13s-shareds -mdll -statictcompilersgcc -mcygwin -O -Wallt compiler_sosgcc -mcygwin -mdll -O -Wallt compiler_cxxsg++ -mcygwin -O -Wallt linker_exes gcc -mcygwint linker_sos%s -mcygwin %ss2.91.57tmsvcrts,Consider upgrading to a newer version of gcc(Rt__init__tcheck_config_ht debug_printt CONFIG_H_OKtwarnt get_versionst gcc_versiont ld_versiontdllwrap_versiont compiler_typet linker_dlltset_executablest dll_librariesR(tselftverbosetdry_runtforcetstatustdetailst shared_option((s1/usr/lib64/python2.7/distutils/cygwinccompiler.pyR!\s<        cCs|dks|dkrZy |jdd|d|gWqtk rV}t|qXnHy)|j|j||d|g|Wntk r}t|nXdS(Ns.rcs.restwindress-is-o(tspawnRRR(R.tobjtsrctexttcc_argstextra_postargstpp_optstmsg((s1/usr/lib64/python2.7/distutils/cygwinccompiler.pyt_compiles  cCstj| pg} tj|p$g}tj|p9g}|j|j|dk r||jksy|jdkrtjj|d}tjj tjj |\}}tjj ||d}tjj |d|d}dtjj |dg}x|D]}|j |q W|j t||fd||jd krx| jd |g| jd |gq|j |n| s| j d ntj||||||||d| | | | | dS( NRis.deftlibs.as LIBRARY %stEXPORTSs writing %sRs --output-libs--defs-s(tcopytextendR-tNonet EXECUTABLER+tostpathtdirnametsplitexttbasenametjointappendtexecuteRRtlink(R.t target_desctobjectstoutput_filenamet output_dirt librariest library_dirstruntime_library_dirstexport_symbolstdebugt extra_preargsR;t build_tempt target_langttemp_dirtdll_namet dll_extensiontdef_filetlib_filetcontentstsym((s1/usr/lib64/python2.7/distutils/cygwinccompiler.pyRMsJ        tcCs|dkrd}ng}x|D]}tjjtjj|\}}||jddgkr{td||fn|rtjj|}n|dks|dkr|jtjj ||||j q"|jtjj |||j q"W|S(NRas.rcs.ress"unknown file type '%s' (from '%s')( RCRERFRHtnormcasetsrc_extensionsRRIRKRJt obj_extension(R.tsource_filenamest strip_dirRQt obj_namestsrc_nametbaseR9((s1/usr/lib64/python2.7/distutils/cygwinccompiler.pytobject_filenames s"  $N(t__name__t __module__R*Rdtstatic_lib_extensiontshared_lib_extensiontstatic_lib_formattshared_lib_formatt exe_extensionR!R>RCRMRj(((s1/usr/lib64/python2.7/distutils/cygwinccompiler.pyRRs*>  XtMingw32CCompilercBs eZdZddddZRS(tmingw32icCstj|||||jdkr.d}nd}|jdkrLd}nd}|jdksjtrsd}nd}|jd d |d d |d d|dd|dd|j|||fg|_t|_dS(Ns2.13s-shareds -mdll -statics2.91.57s--entry _DllMain@12Rat4s -mno-cygwinRsgcc%s -O -WallRsgcc%s -mdll -O -WallRsg++%s -O -WallRsgcc%sRs %s%s %s %s( RR!R(R't is_cygwingccR,R+R-R(R.R/R0R1R4t entry_pointt no_cygwin((s1/usr/lib64/python2.7/distutils/cygwinccompiler.pyR!-s&        (RkRlR*R!(((s1/usr/lib64/python2.7/distutils/cygwinccompiler.pyRr)stoksnot okt uncertaincCsddlm}ddl}|jtjddkrAtdfS|j}y.t|}z|j }Wd|j XWn't k r}t d||j ffSX|j|ddkrtd |fStd |fSdS( sCheck if the current Python installation (specifically, pyconfig.h) 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__". i(t sysconfigNtGCCissys.version mentions 'GCC'scouldn't read '%s': %st__GNUC__s'%s' mentions '__GNUC__'s '%s' does not mention '__GNUC__'(t distutilsRztstringRRRR$tget_config_h_filenametopentreadtclosetIOErrortCONFIG_H_UNCERTAINtstrerrortCONFIG_H_NOTOK(RzR~tfntftstexc((s1/usr/lib64/python2.7/distutils/cygwinccompiler.pyR"es     c Csddlm}ddlm}ddl}|d}|rtj|dd}|j}|j|j d|}|r||j d }qd}nd}|d }|r tj|d d}|j}|j|j d|}|r||j d } q&d} nd} |d } | rtj| d d}|j}|j|j d|}|r||j d } qd} nd} || | fS(sj Try to find out the versions of gcc, ld and dllwrap. If not possible it returns None for it. i(t LooseVersion(tfind_executableNRs -dumpversiontrs(\d+\.\d+(\.\d+)*)itlds -vRs --versions (\d+\.\d+(\.\d+)*)( tdistutils.versionRtdistutils.spawnRtreREtpopenRRtsearchtgroupRC( RRRtgcc_exetoutt out_stringtresultR'tld_exeR(t dllwrap_exeR)((s1/usr/lib64/python2.7/distutils/cygwinccompiler.pyR&sD             cCs;tjdd}|j}|j|jjdS(s>Try to determine if the gcc that would be used is from cygwin.sgcc -dumpmachineRR(RERRRtstriptendswith(RR((s1/usr/lib64/python2.7/distutils/cygwinccompiler.pyRus  (t__doc__t __revision__RERRAtdistutils.ccompilerRRtdistutils.unixccompilerRtdistutils.file_utilRtdistutils.errorsRRRR}RRRRrR$RRR"R&Ru(((s1/usr/lib64/python2.7/distutils/cygwinccompiler.pyts +$ 8 5 .