ó [ÐKc@s:dZddlZddlZddlmZddlmZddlmZddl m Z m Z m Z ddl mZddlmZdd lmZdd lmZdd lmZmZmZmZmZmZmZmZdd lmZye Wn!e!k rdd l"m#Z nXdefd„ƒYZdS(sB Modified version of build_ext that handles fortran source files. iÿÿÿÿN(tglob(t newer_group(t build_ext(tDistutilsFileErrortDistutilsSetupErrortDistutilsError(t copy_file(tlog(t exec_command(t combine_paths(tfilter_sourcest has_f_sourcesthas_cxx_sourcestget_ext_source_filestget_numpy_include_dirst is_sequencetget_build_architecturet msvc_version(tshow_fortran_compilers(tSetRcBs‹eZdZejdgZejdddefgZd„Zd„Z d„Z d„Z d „Z d „Z d „Zd „Zd „ZRS(s:build C/C++/F extensions (compile/link to build directory)s fcompiler=s!specify the Fortran compiler typeshelp-fcompilers list available Fortran compilerscCstj|ƒd|_dS(N(t old_build_exttinitialize_optionstNonet fcompiler(tself((sE/usr/lib/python2.7/site-packages/numpy/distutils/command/build_ext.pyR*s cCsE|j}tj|ƒ|dk rA|jj|jjp:gƒndS(N(t include_dirsRtfinalize_optionsRtextendt distribution(Rt incl_dirs((sE/usr/lib/python2.7/site-packages/numpy/distutils/command/build_ext.pyR.s   c Cs5|js dS|jdƒ|jjƒrÝ|jr«|jjjdƒritjdƒ|jj dƒ}qÇ|jj dƒ}d|_|j ƒ|j ƒd|jjdextension %r has Fortran sources but no Fortran compiler foundsTextension %r has Fortran libraries but no Fortran linker found, using default linkersc++sLextension %r has C++ libraries but no C++ linker found, using default linkertdependsscompiling C sourcest output_dirR(Rtdebugtextra_postargsscompiling C++ sourcess#compiling Fortran 90 module sourcess*.modsfailed to move %r to %rscompiling Fortran sourcesis2.3t target_langR&R'truntime_library_dirstexport_symbolst build_temp(sf77sf90(sf77sf90(=RGRRRREtlisttget_ext_fullnameR4tsplittjoinR;tget_package_dirtostpathtget_ext_filenamet build_libRlR%RRRnRDtextra_compile_argsRFt undef_macrosR<R R"RORHRRRNRKRR7RsRRtcompilet module_dirstdirnametmkpathtmodule_dir_switchRtmodule_optionstabspathtisfiletremovet move_fileRt extra_objectsRtextra_link_argst get_librariesR'tlink_shared_objectt_libs_with_msvc_and_fortrantsystversionRqtget_export_symbols(#RRYRGtfullnametmodpathtpackagetbaseRit package_dirt ext_filenameRlt extra_argsR(tundeft c_sourcest cxx_sourcest f_sourcestfmodule_sourcesRRLtkwsRmRt c_objectsRot f_objectsR€tmodule_build_dirtexisting_modulestftttobjectsR&R'tlinker((sE/usr/lib/python2.7/site-packages/numpy/distutils/command/build_ext.pytbuild_extensionôs                                 $              cCsw|jdƒj}|jdƒj}|jjtjj|dƒgd|jƒ}|jj |dd|d|j ƒdS(NRRsgfortran_vs2003_hack.cRmt_gfortran_workaroundRn( R;RRR"RRyRzRwRstcreate_static_libRn(RR™RRR¤((sE/usr/lib/python2.7/site-packages/numpy/distutils/command/build_ext.pyt_add_dummy_mingwex_sym¨s   cCs|dkrdSx;|D]3}|jdƒr2qnt}xI|pDgD];}tjj|d|ƒ}tjj|ƒrEt}PqEqEW|rqnt}xŽ|D]†}tjj|d|ƒ}tjj|ƒrtjj|j|dƒ}t ||ƒ|j|kr|j |jƒnt}PqqW|r3qnt j d||fƒqWg} x`|j D]U} | jdƒr¦tdd| gd tƒ\} } | s¦| } q¦n| j | ƒq^W|j| ƒx´|jD]©} | jdƒsÎ|j | ƒt| d | d ƒ}|rwtjj|j| dƒ}tjj|ƒsOt |d |ƒn|j|krt|j |jƒqtqwqÎqÎWdS( NRks%s.libslib%s.as.libs+could not find library %r in directories %ss/usr/libtcygpaths-wtuse_teetlibs.ai(Rt startswithRMRyRzRwR†RQRsRR<RR7R'RRR&R (RRt c_librariestc_library_dirsRVt fileexiststlibdirtlibfiletlibfile2t f_lib_dirstdirtstoR¬tptdst_name((sE/usr/lib/python2.7/site-packages/numpy/distutils/command/build_ext.pyR°sZ     !   cCsA|j|jƒg}x$|jD]}|jt|ƒƒq W|S(N(tcheck_extensions_listR1RR (Rt filenamesRY((sE/usr/lib/python2.7/site-packages/numpy/distutils/command/build_ext.pytget_source_filesæs cCsw|j|jƒg}xZ|jD]O}|js5q n|j|jƒ}|jtjj|j |j |ƒƒƒq W|S(N( RºR1RGRuRER<RyRzRwR|R{(RtoutputsRYR‘((sE/usr/lib/python2.7/site-packages/numpy/distutils/command/build_ext.pyt get_outputsís N(s fcompiler=Ns!specify the Fortran compiler type(t__name__t __module__t descriptionRt user_optionsRt help_optionsRRRR:RgR¦R©RR¼R¾(((sE/usr/lib/python2.7/site-packages/numpy/distutils/command/build_ext.pyRs       ¼  ´  6 ($t__doc__RyRŽRtdistutils.dep_utilRtdistutils.command.build_extRRtdistutils.errorsRRRtdistutils.file_utilRtnumpy.distutilsRtnumpy.distutils.exec_commandRtnumpy.distutils.system_infoR tnumpy.distutils.misc_utilR R R R RRRRt'numpy.distutils.command.config_compilerRRBt NameErrortsetsR(((sE/usr/lib/python2.7/site-packages/numpy/distutils/command/build_ext.pyts"  :