ó \ÐKc@sdZddlZddlZddlZddlZddlZddlZddlZddlZ ddl m Z ddlm Z m Z ddlmZmZmZddlmZddlmZddlmZmZejd ƒZejd ƒZd e jjfd „ƒYZd „Z d„Z!d„Z"d„Z#d„Z$d„Z%iZ&ej'dkrÊyCddl(Z(e)e(dƒr‘e(j*e&d.a exists for gcc. If not, build it. # 2. Force windows to use gcc (we're struggling with MSVC and g77 support) # 3. Force windows to use g77 iÿÿÿÿN(t StrictVersion(tgen_preprocess_optionstgen_lib_options(tDistutilsExecErrort CompileErrortUnknownFileError(t UnixCCompiler(tget_build_version(tmsvc_runtime_librarytget_build_architectures\[Ordinal/Name Pointer\] Tables$^\s+\[([\s*[0-9]*)\] ([a-zA-Z0-9_]*)tMingw32CCompilercBsPeZdZdZdddd„Zddddddd„Zddd„ZRS(sH A modified MingW32 compiler compatible with an MSVC built Python. tmingw32ic Cs¯tjjj||||ƒ|jdkr­ddl}tjddgdt dtj ƒ}|j j ƒ}|j j ƒ|jd|ƒ}|r­t|jdƒƒ|_q­n|jdkrÅd }nd }|jd kræd |_n|jdkrd |_ntƒtƒd kr<|jddddddddƒnc|jdkr}|jdddddddd|j|fƒn"|jddddddddƒd g|_dS(Niÿÿÿÿtgccs -dumpversiontshelltstdouts (\d+\.\d+)is2.91.57s--entry _DllMain@12ttdllwrapsg++tAMD64tcompilers/gcc -g -DDEBUG -DMS_WIN64 -mno-cygwin -O0 -Wallt compiler_sosCgcc -g -DDEBUG -DMS_WIN64 -mno-cygwin -O0 -Wall -Wstrict-prototypest linker_exesgcc -g -mno-cygwint linker_sosgcc -g -mno-cygwin -shareds3.0.0sgcc -mno-cygwin -O2 -ws0gcc -mno-cygwin -mdll -O2 -w -Wstrict-prototypessg++ -mno-cygwins%s -mno-cygwin -mdll -static %ssgcc -mno-cygwin -O2 -Walls-gcc -mno-cygwin -O2 -Wall -Wstrict-prototypessg++ -mno-cygwin -shared(t distutilstcygwinccompilertCygwinCCompilert__init__t gcc_versiontNonetret subprocesstPopentTruetPIPERtreadtclosetsearchRtgroupt linker_dlltlinkertbuild_import_libraryR tset_executablest compiler_cxx( tselftverbosetdry_runtforceRtpt out_stringtresultt entry_point((sD/usr/lib/python2.7/site-packages/numpy/distutils/mingw32ccompiler.pyR0sJ          cCs£tƒ}|r.|sg}n|j|ƒn||||||||d| | | | | f}|jdkrtjjj}n tj}|||j j j ŒdS(Ns3.0.0( RtappendRRRRRtlinkRtim_funct func_codet co_argcount(R*t target_desctobjectstoutput_filenamet output_dirt librariest library_dirstruntime_library_dirstexport_symbolstdebugt extra_preargstextra_postargst build_tempt target_langtruntime_librarytargstfunc((sD/usr/lib/python2.7/site-packages/numpy/distutils/mingw32ccompiler.pyR3‡s0    Rc Cs.|dkrd}ng}x |D]}tjjtjj|ƒƒ\}}tjj|ƒ\}}|rw|d}n||jddgkr¦td||f‚n|rÁtjj|ƒ}n|dksÙ|dkr|j tjj ||||j ƒƒq"|j tjj |||j ƒƒq"W|S(NRis.rcs.ress"unknown file type '%s' (from '%s')( Rtostpathtsplitexttnormcaset splitdrivetsrc_extensionsRtbasenameR2tjoint obj_extension( R*tsource_filenamest strip_dirR:t obj_namestsrc_nametbasetexttdrv((sD/usr/lib/python2.7/site-packages/numpy/distutils/mingw32ccompiler.pytobject_filenames±s(  $ N(t__name__t __module__t__doc__t compiler_typeRRR3RW(((sD/usr/lib/python2.7/site-packages/numpy/distutils/mingw32ccompiler.pyR )s \ cCsþgtjd D]}t|ƒ^q\}}}d||f}d|GHg}|jtjjtjdƒƒy'|jtjjtjddƒƒWnt k r§nXx9|D]1}tjj||ƒ}tjj |ƒr¯|Sq¯Wt d||fƒ‚dS(Nispython%d%d.dllsLooking for %stlibt SYSTEMROOTtsystem32s%s not found in %s( tsyst version_infotintR2RGRHRNtprefixtenvirontKeyErrortexistst ValueError(titmajtmintmicrotdllnametlib_dirstdtdll((sD/usr/lib/python2.7/site-packages/numpy/distutils/mingw32ccompiler.pytfind_python_dllÔs/ '  cCs.tjdd|gdtjƒ}|jjƒS(Ns objdump.exes-pR(RRR Rt readlines(Rntst((sD/usr/lib/python2.7/site-packages/numpy/distutils/mingw32ccompiler.pyt dump_tableës!c Cs†t|ƒ}x1tt|ƒƒD]}tj||ƒrPqqW|t|ƒkratdƒ‚ng}xot|dt|ƒƒD]T}tj||ƒ}|rÔ|jt|j dƒj ƒƒ|j dƒfƒqPqWt|ƒdkrÿt j d|ƒnt |dƒ}|jdtjj|ƒƒ|jdƒ|jd ƒ|jd ƒx#|D]}|jd |dƒqYW|jƒd S( sŠGiven a dll file location, get all its exported symbols and dump them into the given def file. The .def file will be overwrittensSymbol table not foundiiisNo symbols found in %stwsLIBRARY %s s,;CODE PRELOAD MOVEABLE DISCARDABLE s;DATA PRELOAD SINGLE s EXPORTS s%s N(Rrtrangetlent_STARTtmatchRft_TABLER2RaR$tstriptlogtwarntopentwriteRGRHRMR"( RntdfiletdumpRgtsymstjtmRmts((sD/usr/lib/python2.7/site-packages/numpy/distutils/mingw32ccompiler.pyt generate_defïs,  4    cCsVtjdkrdStƒ}|dkr/tƒS|dkrBtƒStd|ƒ‚dS(NtntRtIntelsUnhandled arch %s(RGtnameR t_build_import_library_amd64t_build_import_library_x86Rf(tarch((sD/usr/lib/python2.7/site-packages/numpy/distutils/mingw32ccompiler.pyR's   cCsÞtƒ}dttjd ƒ}tjjtjd|ƒ}tjj|ƒrbt j d|ƒdSdttjd ƒ}tjjtjd|ƒ}t j d||fƒt ||ƒdd|d |g}t j|ƒdS( Nslibpython%d%d.aitlibss)Skip building import library: "%s" existsspython%d%d.defs4Building import library (arch=AMD64): "%s" (from %s)tdlltools-ds-l(RottupleR_R`RGRHRNRbtisfileRzR?tinfoR„RR(tdll_filetout_nametout_filetdef_nametdef_filetcmd((sD/usr/lib/python2.7/site-packages/numpy/distutils/mingw32ccompiler.pyRˆs   cCs·dttjd ƒ}tjjtjd|ƒ}dttjd ƒ}tjjtjd|ƒ}tjj|ƒs‹tj d|ƒdStjj|ƒr²tj d|ƒdStj d|ƒd d l m }d ttjd ƒ}tjjtjd|ƒ}d |j|f}|j|ƒ}|j|ƒ\} } |j| | |jt|d ƒƒdttjd ƒ} | ||f} d| } tj| ƒ}|r³tj dƒndS(s; Build the import libraries for Mingw32-gcc on Windows spython%d%d.libiR‹slibpython%d%d.as+Cannot build import library: "%s" not foundNs)Skip building import library: "%s" existss(Building import library (ARCH=x86): "%s"iÿÿÿÿ(tlib2defspython%d%d.defs%s %sRsspython%d%d.dlls-dlltool --dllname %s --def %s --output-lib %ss:Failed to build import library for gcc. Linking will fail.(RR_R`RGRHRNRbRŽRzR{R?Rtnumpy.distutilsR–t DEFAULT_NMtgetnmtparse_nmt output_deft DEF_HEADERR|tsystem(tlib_nametlib_fileR‘R’R–R“R”tnm_cmdt nm_outputtdlisttflisttdll_nameRER•tstatus((sD/usr/lib/python2.7/site-packages/numpy/distutils/mingw32ccompiler.pyR‰1s2" twin32tCRT_ASSEMBLY_VERSIONt90s 9.0.21022.8s 8.0.50727.42t80s9Cannot import msvcrt: using manifest will not be possiblecCsiytt|d|ƒ}Wn'tk rEtd||fƒ‚nXd}|i|d6|d6|d6S(sUGiven a major and minor version of the MSVCR, returns the corresponding XML file.i s)Version %d,%d of MSVCRT not supported yetsS tfullverRhRi(t_MSVCRVER_TO_FULLVERtstrRdRf(RhRiRªttemplate((sD/usr/lib/python2.7/site-packages/numpy/distutils/mingw32ccompiler.pytmsvc_manifest_xmlws RncCsH|dkrd}n%|dkr*d}ntd|ƒ‚d||fS(sOReturn the rc file used to generate the res file which will be embedded as manifest for given manifest file name, of given type ('dll' or 'exe'). Parameters ---------- name: str name of the manifest file to embed type: str ('dll', 'exe') type of the binary which will embed the manifestRnitexeisType %s not supporteds&#include "winuser.h" %d RT_MANIFEST %s(Rf(R‡ttypetrctype((sD/usr/lib/python2.7/site-packages/numpy/distutils/mingw32ccompiler.pyt manifest_rc—s    cCsWtƒ}|rSt|dd!ƒ}|t|ƒksStdt|ƒ|f‚qSndS(s6msver is the ms runtime version used for the MANIFEST.iisKDiscrepancy between linked msvcr (%d) and the one about to be embedded (%d)N(RRaRf(tmsvertmsvcvRh((sD/usr/lib/python2.7/site-packages/numpy/distutils/mingw32ccompiler.pyt!check_embedded_msvcr_match_linked¬s cCs5tjj|jdgdƒƒ}tjj|ƒdS(Ntyotci(RGRHRMt_gen_temp_sourcefileRI(tconfigRT((sD/usr/lib/python2.7/site-packages/numpy/distutils/mingw32ccompiler.pytconfigtest_name¹s!cCs$t|ƒ}|jj}||dS(Ns .manifest(RºRt exe_extension(R¹troottexext((sD/usr/lib/python2.7/site-packages/numpy/distutils/mingw32ccompiler.pyt manifest_name½s  cCst|ƒ}|dS(Ns.rc(Rº(R¹R¼((sD/usr/lib/python2.7/site-packages/numpy/distutils/mingw32ccompiler.pytrc_nameÃs cCs¦tƒ}|dk r¢|dkr¢t|ƒt|ƒ}t||dƒ}t||ƒ}tt|ƒdƒ}|jjt|ƒƒ|j |ƒ|j ƒq¢ndS(Nii Rs( tget_build_msvc_versionRRµRaR®R|R¾t temp_filesR2R}R"(R¹R³tmatmitmanxmltman((sD/usr/lib/python2.7/site-packages/numpy/distutils/mingw32ccompiler.pytgenerate_manifestÈs      (4RZRGRR_RzRtnumpy.distutils.ccompilertnumpytdistutils.cygwinccompilerRtdistutils.versionRRRtdistutils.errorsRRRtdistutils.unixccompilerRtdistutils.msvccompilerRRÀtnumpy.distutils.misc_utilRR tcompileRvRxRRR RoRrR„R'RˆR‰R«tplatformtmsvcrtthasattrR§t ImportErrorR{R®R²RµRºR¾R¿RÆ(((sD/usr/lib/python2.7/site-packages/numpy/distutils/mingw32ccompiler.pyt sP        «   "  5