ó 2ÄÈ[c@`s<dZddlmZmZmZddlZddlZddlZddlmZddl m Z ddl m Z ddlmZmZmZddlmZdd lmZdd lmZdd lmZmZdd lmZmZmZmZm Z m!Z!m"Z"m#Z#dd l$m%Z%de fd„ƒYZ dS(sC Modified version of build_ext that handles fortran source files. i(tdivisiontabsolute_importtprint_functionN(tglob(t newer_group(t build_ext(tDistutilsFileErrortDistutilsSetupErrortDistutilsError(t copy_file(tlog(t exec_command(t combine_pathst system_info(tfilter_sourcest has_f_sourcesthas_cxx_sourcestget_ext_source_filestget_numpy_include_dirst is_sequencetget_build_architecturet msvc_version(tshow_fortran_compilersRcB`s—eZdZejddgZejdddefgZd„Zd „Z d „Z d „Z d „Z d „Z d„Zd„Zd„Zd„ZRS(s:build C/C++/F extensions (compile/link to build directory)s fcompiler=s!specify the Fortran compiler types parallel=tjsnumber of parallel jobsshelp-fcompilers list available Fortran compilerscC`s#tj|ƒd|_d|_dS(N(t old_build_exttinitialize_optionstNonet fcompilertparallel(tself((s@/tmp/pip-build-fiC0ax/numpy/numpy/distutils/command/build_ext.pyR,s  cC`sß|jrByt|jƒ|_WqBtk r>tdƒ‚qBXnt|jtƒro|jjtjƒ|_n|jp{g}|j jdkrŸg|j _n|j j|_|jj |ƒt j |ƒ|jddƒdS(Ns)--parallel/-j argument must be an integertbuildR(RR(Rtintt ValueErrort isinstancet include_dirststrtsplittostpathsept distributionRtextendRtfinalize_optionstset_undefined_options(Rt incl_dirs((s@/tmp/pip-build-fiC0ax/numpy/numpy/distutils/command/build_ext.pyR)1s    c `s9ˆjs dSˆjdƒˆjjƒr݈jr«ˆjjjdƒritjdƒˆjj dƒ}qLjjj dƒ}d|_|j ƒ|j ƒdˆjjd||ƒqÅWqsWdS(!Nt build_srct build_clibsMbuild_clib already run, it is too late to ensure in-place build of build_clibii(t new_compiler(t new_fcompilertcompilertverbosetdry_runtforces.libssKlibrary %r defined more than once, overwriting build_info %s... with %s...i,t librariest library_dirstmacrostsource_languagess-updating extension %r libraries from %r to %rs-extending extension %r defined_macros with %rtf77sc++tf90tcs.resetting extension %r language from %r to %r.tneed_cxxt requiref90t c_compilers!f77_compiler=%s is not available.s!f90_compiler=%s is not available.c3`s.|]$}ˆj|jƒjdƒdVqdS(t.iN(tget_ext_fullnametnameR$(t.0text(R(s@/tmp/pip-build-fiC0ax/numpy/numpy/distutils/command/build_ext.pys ss.dll(?t extensionst run_commandR'thas_c_librariestinplacethave_runtgetR twarntget_command_objtensure_finalizedtruntget_finalized_commandR5tappendR-Rtdistutils.ccompilerR.tnumpy.distutils.fcompilerR/R0R1R2R3t customizet customize_cmdtshow_customizationR%tpathtjoint build_tempt extra_dll_dirtisdirtmakedirsR4treprtsettaddtinfoR@t define_macrosRtsourcesRtlanguagetdetect_languagetupdatet _cxx_compilert cxx_compilerRtFalset _f77_compilert compiler_typet get_versiontTruet _f90_compilertbuild_extensionst build_libtlistdirtlowertendswithR (RR-R.R/Rgtclibstlibnamet build_infot all_languagesRBt ext_languagestc_libst c_lib_dirsR6tbinfotmtlt new_c_libst ext_languagetneed_f90_compilertneed_f77_compilertneed_cxx_compilerR0tctypeRt pkg_rootstpkg_roottshared_lib_dirtfnt runtime_lib((Rs@/tmp/pip-build-fiC0ax/numpy/numpy/distutils/command/build_ext.pyRLKs6                   ,      %                                                cC`s|S(N((RR_((s@/tmp/pip-build-fiC0ax/numpy/numpy/distutils/command/build_ext.pyt swig_sourcessc$C`s¥|j}|dks"t|ƒ r@tddd|jƒ‚nt|ƒ}|sVdS|j|jƒ}|jrß|jdƒ}dj |dd!ƒ}|d}|j dƒ}|j |ƒ}t j j ||j|ƒƒ} n!t j j |j|j|ƒƒ} ||j} |jp%t| | dƒs?tjd |jƒdStjd |jƒ|jp^g} |j} x!|jD]} | j| fƒquWt|jƒ\}}}}|jjd krå|rÒ| jd ƒn||7}g}n|jd kr|j}n-|jdkr|j}n|jp*|j}|dk rŠt |dƒrW|j!pZgng|_!t |dƒr~|j"pgng|_"n|j#}|r»|dkr»t$d|jƒ‚n|sÇ|ré|dkrét$d|jƒ‚n|jd*kr|dkr|j%d|jƒn|jdkrM|dkrM|j%d|jƒni|jd6}|j&}|j't(ƒ}g}|rÈtjdƒ|jj)|d|d| d|d|jd| |}n|rtjdƒ||j)|d|d| d|d|jd| |7}ng}g}|rÊtjdƒ|j*}t j j |j&t j j+|j|ƒƒƒ}|j,|ƒ|j-dkr–t.dƒ}n||j/||ƒ7}||j)|d|j&d| d|d|jd|d|jƒ7}|j-dkrÊxÉt.dƒD]¸}||kr qnt j j ||ƒ}t j j0|ƒt j j0|ƒkr_qnt j j1|ƒrt j2|ƒny|j3||ƒWqt4k r¿tj%d ||fƒqXqWqÊn|r tjd!ƒ||j)|d|j&d| d|d|jd|d|jƒ7}n|rH|j5|jƒ rH|}|} ng}||} |j6rt| j7|j6ƒn|j8p€g} |j9|ƒ}!|j:}"|jj;}#|jjd+krÑ|j<||!|"ƒn'|jd,krø|dk rø|j;}#n|jdkr|dk r|j;}#n|dk rO|j=| |!||"|ƒ\} }!n|#| | d$|!d%|"d&|j>d| d'|j?|ƒd|jd(|j&d)|jƒdS(-Ns*in 'ext_modules' option (extension '%s'), s&'sources' must be present and must be sa list of source filenamesR>iiÿÿÿÿtbuild_pytnewers$skipping '%s' extension (up-to-date)sbuilding '%s' extensiontmsvcs/Zm1000R9R8textra_f77_compile_argstextra_f90_compile_argss5extension %r has C++ sourcesbut no C++ compiler founds>extension %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_dirR6R"tdebugtextra_postargsscompiling C++ sourcess#compiling Fortran 90 module sourcess*.modsfailed to move %r to %rscompiling Fortran sourcestintelwtintelemwR4R5truntime_library_dirstexport_symbolsRVt target_lang(R8R9(RˆRR(R8R9(@R_RRRR@tlistR?RFR$RURMtget_package_dirR%RTtget_ext_filenameRlR‹R3RR RR]textra_compile_argsR^t undef_macrosRNRR0RgR`RjRfthasattrR‰RŠRcRRIRVR"Rtcompilet module_dirstdirnametmkpathtmodule_dir_switchRtmodule_optionstabspathtisfiletremovet move_fileRtcan_ccompiler_linkt extra_objectsR(textra_link_argst get_librariesR5tlink_shared_objectt_libs_with_msvc_and_fortrant_process_unlinkable_fobjectsR‘tget_export_symbols($RRBR_tfullnametmodpathtpackagetbaseR†t package_dirt ext_filenameR‹t extra_argsR6tundeft c_sourcest cxx_sourcest f_sourcestfmodule_sourcesRRdtkwsRŒR"t c_objectsRŽt f_objectsR›tmodule_build_dirtexisting_modulestftttunlinkable_fobjectstobjectsR4R5tlinker((s@/tmp/pip-build-fiC0ax/numpy/numpy/distutils/command/build_ext.pytbuild_extension!s4            $'                    $                 cC`sw|jdƒj}|jdƒj}|jjtjj|dƒgd|jƒ}|jj |dd|d|j ƒdS(NR,R-sgfortran_vs2003_hack.cRŒt_gfortran_workaroundR( RMR,R-R0RšR%RTRURVtcreate_static_libR(RR´R,R-RÀ((s@/tmp/pip-build-fiC0ax/numpy/numpy/distutils/command/build_ext.pyt_add_dummy_mingwex_symàs   c C`sht|ƒ}t|ƒ}t|ƒ}xÛt|ƒD]Í}xÄ|D]¼}tjj||dƒ}tjj|ƒr>|j|ƒt|dƒ } |j| jƒj ƒƒWdQXtjj||dƒ} t| dƒ } |j| jƒj ƒƒWdQXq>q>Wq1W|r^g|D]} tjj | ƒ^q} |j | d|j d|j ƒ} |j| ƒn||fS(Ns .fobjectstrs .cobjectsRŒRW(R”R%RTRUR¡R¢topenR(treadt splitlinestrelpathtwrap_unlinkable_objectsRVRW(RRÀR4RR5R¿tlibtlibdirtfake_libR½tc_libtobjtfobjectstwrapped((s@/tmp/pip-build-fiC0ax/numpy/numpy/distutils/command/build_ext.pyRªés(     *% cC`s|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( NRˆs%s.libslib%s.as.libs+could not find library %r in directories %ss/usr/libtcygpaths-wtuse_teeRÌs.ai(Rt startswithReR%RTRUR¡RiRVR RNR RIR5R R(R4R (RRt c_librariestc_library_dirsRqt fileexistsRÍtlibfiletlibfile2t f_lib_dirstdirtstoRÌtptdst_name((s@/tmp/pip-build-fiC0ax/numpy/numpy/distutils/command/build_ext.pyR© sZ     !   cC`sA|j|jƒg}x$|jD]}|jt|ƒƒq W|S(N(tcheck_extensions_listRCR(R(Rt filenamesRB((s@/tmp/pip-build-fiC0ax/numpy/numpy/distutils/command/build_ext.pytget_source_filesCs cC`sw|j|jƒg}xZ|jD]O}|js5q n|j|jƒ}|jtjj|j |j |ƒƒƒq W|S(N( RáRCR_R?R@RNR%RTRURlR–(RtoutputsRBR¬((s@/tmp/pip-build-fiC0ax/numpy/numpy/distutils/command/build_ext.pyt get_outputsJs N(s fcompiler=Ns!specify the Fortran compiler type(s parallel=Rsnumber of parallel jobs(t__name__t __module__t descriptionRt user_optionsRt help_optionsRRR)RLR…RÂRÅRªR©RãRå(((s@/tmp/pip-build-fiC0ax/numpy/numpy/distutils/command/build_ext.pyRs&      Ò  ¿ : (&t__doc__t __future__RRRR%tsystshutilRtdistutils.dep_utilRtdistutils.command.build_extRRtdistutils.errorsRRRtdistutils.file_utilR tnumpy.distutilsR tnumpy.distutils.exec_commandR tnumpy.distutils.system_infoR R tnumpy.distutils.misc_utilRRRRRRRRt'numpy.distutils.command.config_compilerR(((s@/tmp/pip-build-fiC0ax/numpy/numpy/distutils/command/build_ext.pyts   :