\Kc@sddlZddlZddlZddlmZmZddlmZddlm Z m Z ddl m Z ddlmZmZddlmZmZddlmZdd lmZdd lmZmZdd lmZd Zd ZdZdZ dZ!dZ"dZ#dZ$dZ%dZ&dZdZ'dZ(dZ)dZ*dZ+dZ,dZ-dZ.dZ/d Z0d!Z1d"Z2d#Z3d$Z4d%Z5d&e fd'YZ6dS((iN(tjointdirname(tDistutilsPlatformError(tDistutilsExecErrortDistutilsSetupError(t build_ext(t CCompilert new_compiler(t FCompilert new_fcompiler(tfind_executable(tlog(tis_bootstrappingtget_cmd(tget_numpy_include_dirscCsddlm}|S(sqReturn the top path where everything produced by scons will be put. The path is relative to the top setup.pyi(tget_scons_build_dir(tnumsconsR(R((sA/usr/lib/python2.7/site-packages/numpy/distutils/command/scons.pyRscCs&ddlm}tt||S(siReturn the build directory for the given package (foo.bar). The path is relative to the top setup.pyi(t pkg_to_path(tnumscons.core.utilsRtpjoinR(tpkgR((sA/usr/lib/python2.7/site-packages/numpy/distutils/command/scons.pytget_scons_pkg_build_dirscCsddlm}|S(sqReturn the top path where everything produced by scons will be put. The path is relative to the top setup.pyi(tget_scons_configres_dir(RR(R((sA/usr/lib/python2.7/site-packages/numpy/distutils/command/scons.pyR$scCsddlm}|S(sqReturn the top path where everything produced by scons will be put. The path is relative to the top setup.pyi(tget_scons_configres_filename(RR(R((sA/usr/lib/python2.7/site-packages/numpy/distutils/command/scons.pyR+scCsddlm}|S(sEThis returns the full path where scons.py for scons-local is located.i(tget_scons_path(RR(R((sA/usr/lib/python2.7/site-packages/numpy/distutils/command/scons.pytget_scons_local_path2scCszddlm}ddlm}t|||}|jtj}tjjgt |dD]}tj ^qdS(Ni(R(Ri( RRRRRtcounttostsepRtrangetpardir(RRRtscdirtnti((sA/usr/lib/python2.7/site-packages/numpy/distutils/command/scons.pyt _get_top_dir7s cCstt||jS(s`Returns the path where distutils install libraries, relatively to the scons build directory.(RR"t build_lib(tcmdR((sA/usr/lib/python2.7/site-packages/numpy/distutils/command/scons.pytget_distutils_libdirBscCstt||jS(s6Returns the path where distutils put pure C libraries.(RR"t build_clib(R$R((sA/usr/lib/python2.7/site-packages/numpy/distutils/command/scons.pytget_distutils_clibdirGscCsUddlm}|dkr&||Stdjd}t|j||SdS(s6Returns the installation path for the current package.i(RitinstallN(RRR tget_finalized_commandRtinstall_libbase(RtinplaceRt install_cmd((sA/usr/lib/python2.7/site-packages/numpy/distutils/command/scons.pytget_distutils_install_prefixKs   cCstjS(sEThis returns the python executable from which this file is invocated.(tsyst executable(((sA/usr/lib/python2.7/site-packages/numpy/distutils/command/scons.pytget_python_exec_invocTscCsddlm}t|t|}|jtj}t}g}xP|D]H}|jttjj gt |dD]}tj ^qy|qPW|S(sYReturn include dirs for numpy. The paths are relatively to the setup.py script path.i(Ri( RRRtpdirnameRRRt_incdirtappendRRR(tsconscript_pathRRR tdirstrdirstdR!((sA/usr/lib/python2.7/site-packages/numpy/distutils/command/scons.pyR^s  FcCstjj|S(sGiven a list of directories, returns a string where the paths are concatenated by the path separator. example: ['foo/bar', 'bar/foo'] will return 'foo/bar:bar/foo'.(RtpathsepR(tdirlist((sA/usr/lib/python2.7/site-packages/numpy/distutils/command/scons.pyt dirl_to_strlscCs8|j}|dkrdS|dkr)dS|jdSdS(sThis converts the name passed to distutils to scons name convention (C compiler). compiler should be a CCompiler instance. Example: --compiler=intel -> intelctmsvctinteltintelciN(t compiler_typetcompiler(R?R>((sA/usr/lib/python2.7/site-packages/numpy/distutils/command/scons.pyt dist2sconsccss    cCsT|jdkrdS|jdkr&dS|jdkr9dS|jdkrLdSd Sd S( sThis converts the name passed to distutils to scons name convention (Fortran compiler). The argument should be a FCompiler instance. Example: --fcompiler=intel -> ifort on linux, ifl on windowsR<tiforttgnutg77tgnu95tgfortrantsuntsunf77tfortranN(R>(R?((sA/usr/lib/python2.7/site-packages/numpy/distutils/command/scons.pyt dist2sconsfcscCs!|jdkr|jS|jdS(sThis converts the name passed to distutils to scons name convention (C++ compiler). The argument should be a Compiler instance.R;i(R>t compiler_cxx(R?((sA/usr/lib/python2.7/site-packages/numpy/distutils/command/scons.pyt dist2sconscxxscCs"|jdkrdS|jdSdS(sFor any give CCompiler instance, this gives us the name of C compiler (the actual executable). NOTE: does NOT work with FCompiler instances.R;scl.exeiN(R>R?(R?((sA/usr/lib/python2.7/site-packages/numpy/distutils/command/scons.pytget_compiler_executablescCs |jdS(sdFor any give FCompiler instance, this gives us the name of F77 compiler (the actual executable).i(t compiler_f77(R?((sA/usr/lib/python2.7/site-packages/numpy/distutils/command/scons.pytget_f77_compiler_executablescCs"|jdkrdS|jdSdS(sFor any give CCompiler instance, this gives us the name of CXX compiler (the actual executable). NOTE: does NOT work with FCompiler instances.R;scl.exeiN(R>RJ(R?((sA/usr/lib/python2.7/site-packages/numpy/distutils/command/scons.pytget_cxxcompiler_executablescCs7tt|}|r't|}n td|S(sjGiven a distutils.ccompiler.CCompiler class, returns the path of the toolset related to C compilation.s1Could not find compiler executable info for scons(R RLR1R(R?t fullpath_exectfullpath((sA/usr/lib/python2.7/site-packages/numpy/distutils/command/scons.pyt get_tool_paths  cCs7tt|}|r't|}n td|S(slGiven a distutils.ccompiler.FCompiler class, returns the path of the toolset related to F77 compilation.s5Could not find F77 compiler executable info for scons(R RNR1R(R?RPRQ((sA/usr/lib/python2.7/site-packages/numpy/distutils/command/scons.pytget_f77_tool_paths  cCs7tt|}|r't|}n td|S(sjGiven a distutils.ccompiler.CCompiler class, returns the path of the toolset related to C compilation.s1Could not find compiler executable info for scons(R ROR1R(R?RPRQ((sA/usr/lib/python2.7/site-packages/numpy/distutils/command/scons.pytget_cxx_tool_paths  cCs|rd|dSdSdS(sxConvert path (given as a string) to something the shell will have no problem to understand (space, etc... problems).t"s""N((tpath((sA/usr/lib/python2.7/site-packages/numpy/distutils/command/scons.pyt protect_paths cCs |jdS(Nt,(tsplit(tpkglist((sA/usr/lib/python2.7/site-packages/numpy/distutils/command/scons.pytparse_package_listscCs[tg|D]}|df^q }gtt|D]}|j||r8|^q8S(sGiven two list, return the index of the common items. The index are relative to seq1. Note: do not handle duplicate items.N(tdicttNoneRtlenthas_key(tseq1tseq2R!tdict2((sA/usr/lib/python2.7/site-packages/numpy/distutils/command/scons.pyt find_commons%cCsDt||}t|t|ks@d|}t|n|S(s[Given a list of packages in pkglist, return the list of packages which match this list.sYthe package list contains a package not found in the current list. The current list is %s(RcR^t ValueError(tsconspkgRZtcommontmsg((sA/usr/lib/python2.7/site-packages/numpy/distutils/command/scons.pytselect_packagess cCsyddl}Wn)tk r;}tdt|nXyddlm}t|dtr{tdt|nt|}|d |krtdt|t|d fnWn*tk rtd ||jfnXdS( s`Check that we can use numscons. minver is a 3 integers tuple which defines the min version.iNslimporting numscons failed (error was %s), using scons within distutils is not possible without this package (t version_infois/Numscons %s or above expected (detected 0.10.0)is'Numscons %s or above expected (got %s) sTYou need numscons >= %s to build numpy with numscons (imported numscons path is %s).( Rt ImportErrort RuntimeErrortstrRit isinstanceRdttuplet__file__(tminverRteRi((sA/usr/lib/python2.7/site-packages/numpy/distutils/command/scons.pytcheck_numsconss" ' tsconscBseZdZd/d0d1d2d3d4d5gZd6d7d8d9d:d;d<d=d>d?d@dAg eZd'Zd(Zd)Zd*Z d+Z d,Z d-Z RS(Bs Scons builders with-perflib=sdSpecify which performance library to use for BLAS/LAPACK/etc...Examples: mkl/atlas/sunper/accelerates with-mkl-lib=tTODOswith-mkl-include=swith-mkl-libraries=swith-atlas-lib=swith-atlas-include=swith-atlas-libraries=sjobs=tjs4specify number of worker threads when executingsconsR+R!sIf specified, build in place.s import-envRqs<If specified, import user environment into scons env["ENV"].tbypasstbs3Bypass distutils compiler detection (experimental).sscons-tool-path=s:specify additional path (absolute) to look for scons toolsssilent=sespecify whether scons output should less verbose(1), silent (2), super silent (3) or not (0, default)s log-level=sVspecify log level for numscons. Any value valid for the logging python module is valids package-list=syIf specified, only run scons on the given packages (example: --package-list=scipy.cluster). If empty, no package is builts fcompiler=s!specify the Fortran compiler types compiler=sspecify the C compiler types cxxcompiler=s4specify the C++ compiler type (same as C by default)tdebugtgs'compile/link with debugging informationcCstj|d|_d|_d|_d|_d|_d|_d|_ d|_ d|_ t |_ d|_d|_d|_d|_d|_d|_d|_d|_d|_d|_g|_g|_g|_g|_g|_g|_g|_dS(Niti2(t old_build_exttinitialize_optionsR]R&RxR?t cxxcompilert fcompilertjobstsilentt import_envtscons_tool_pathtFalset_bypass_distutils_cctscons_compilertscons_compiler_pathtscons_fcompilertscons_fcompiler_pathtscons_cxxcompilertscons_cxxcompiler_patht package_listR+Rvt log_levelt with_perflibt with_mkl_libtwith_mkl_includetwith_mkl_librariestwith_atlas_libtwith_atlas_includetwith_atlas_libraries(tself((sA/usr/lib/python2.7/site-packages/numpy/distutils/command/scons.pyR|Js8                           c Cs|dkrt|_ny~td|d|jd|jd|j}|j|jt|drq|j nt ||_ t t ||_Wn.tk r}|js|q||_ nXdS(NR;R?tverbosetdry_runtforcet initialize(tTrueRRRRRt customizet distributionthasattrRR@RRWRRRR(RR>tdistutils_compilerRq((sA/usr/lib/python2.7/site-packages/numpy/distutils/command/scons.pyt_init_ccompilerus          c Cstd|d|jd|jd|j|_|jdk r||jj|jt|j|_ t t |j|_ ndS(NR?RRR( R RRRR~R]RRRIRRWRSR(RR>((sA/usr/lib/python2.7/site-packages/numpy/distutils/command/scons.pyt_init_fcompilers   c Cstd|d|jd|jd|j}|dk r|j|jdd|j||j|_ yt |j Wnt k rd|_ nX|j rt |j |_ tt |j |_qndS(NR?RRRtneed_cxxi(RRRRR]RRt customize_cmdt cxx_compilerR}RTRRKRRWR(RR>R}((sA/usr/lib/python2.7/site-packages/numpy/distutils/command/scons.pyt_init_cxxcompilers         cCstj|g|_g|_g|_g|_g|_|jjrxs|jj D]e}|jj |j |jj |j |jj |j |jj |j|jj |jqVWtdjd}|j|_n|js|j|_nt|jdkrs|jr@|j|_|j|_|j|_qs|j|j|j|j|j|jn|jrt|j|_ndS(NR&i( R{tfinalize_optionst sconscriptst pre_hookst post_hookst pkg_namest pkg_pathsRthas_scons_scriptst scons_dataR3t scons_pathtpre_hookt post_hookt parent_nametpkg_pathR R)R&R}R?R^RvRR~RRRRRRR[(RR!tbuild_clib_cmd((sA/usr/lib/python2.7/site-packages/numpy/distutils/command/scons.pyRs6            c CsU|d|dg}|jr8|jdt|jn|jrQ|jdn|jd|j|jdt||jd||jd||jd |j|jd tt|||jd tt ||t ||j}|jd t||j s;|jd |j n|j r[|jd|j n|jd |j |jd|j|jr|jd|jn|jr|jd|jn|jr|jd|jn|jr|jd|jn|jdtt||jd|j|jd|j|jrt|jdkrv|jdqt|jdkr|jdqn|jdt|j|jd|dj|}t|jdkrtjd||ntjd |tj|} | rQd!} | d"7} | d#7} t| ndS($Ns-fs-I.s --jobs=%ds inplace=1sscons_tool_path="%s"s src_dir="%s"s pkg_path="%s"s pkg_name="%s"s log_level=%ssdistutils_libdir=%ssdistutils_clibdir=%ssdistutils_install_prefix=%ss cc_opt=%sscc_opt_path=%ssdebug=%ss f77_opt=%ssf77_opt_path=%ss cxx_opt=%sscxx_opt_path=%ssinclude_bootstrap=%ss bypass=%ss import_env=%sis-Qis-ss silent=%dsbootstrapping=%dt is(Executing scons command (pkg is %s): %s s5======== Executing scons command for pkg %s =========s$Error while executing scons command.s! See above for more information. sIf you think it is a problem in numscons, you can also try executing the scons command with --log-level option for more detailed output of what numscons is doing, for example --log-level=0; the lowest the level is, the more detailed the output it.(RR3tintR+RR1RRWR%R'R-RRRRxRRRRR:RRvRRRR tinfoRtsystemR( Rt scons_exect sconscripttpkg_nameRt bootstrappingR$tprefixtcmdstrtstRg((sA/usr/lib/python2.7/site-packages/numpy/distutils/command/scons.pyt _call_sconssf             cCst|jdkrdStdd |jdk rt|j|j}g|D]}|j|^qQ}g|D]}|j|^qq}g|D]}|j|^q}g|D]}|j|^q}g|D]}|j |^q}n-|j}|j}|j}|j}|j }t r,d}nd}t } | dt t td7} xt|||||D]h\} } } } }| r| n| r|j| | | ||n| rt| i| d6|d6qtqtWdS( NiRpii Rsscons.pyRt scons_cmd(ii i(R^RRrRR]RhRRRRR R0RWRRtzipR(RtidR!RRRRRRRRRRRR((sA/usr/lib/python2.7/site-packages/numpy/distutils/command/scons.pytrun"s:     #           N(s with-perflib=NsdSpecify which performance library to use for BLAS/LAPACK/etc...Examples: mkl/atlas/sunper/accelerate(s with-mkl-lib=NsTODO(swith-mkl-include=NsTODO(swith-mkl-libraries=NsTODO(swith-atlas-lib=NsTODO(swith-atlas-include=NsTODO(swith-atlas-libraries=NsTODO(sjobs=Rus4specify number of worker threads when executingscons(sinplaceR!sIf specified, build in place.(s import-envRqs<If specified, import user environment into scons env["ENV"].(sbypassRws3Bypass distutils compiler detection (experimental).(sscons-tool-path=Ns:specify additional path (absolute) to look for scons tools(ssilent=Nsespecify whether scons output should less verbose(1), silent (2), super silent (3) or not (0, default)(s log-level=NsVspecify log level for numscons. Any value valid for the logging python module is valid(s package-list=NsyIf specified, only run scons on the given packages (example: --package-list=scipy.cluster). If empty, no package is built(s fcompiler=Ns!specify the Fortran compiler type(s compiler=Nsspecify the C compiler type(s cxxcompiler=Ns4specify the C++ compiler type (same as C by default)(sdebugRys'compile/link with debugging information( t__name__t __module__t descriptionR]tlibrary_optionst user_optionsR|RRRRRR(((sA/usr/lib/python2.7/site-packages/numpy/distutils/command/scons.pyRs#s@  +   1 J(7RR.tos.pathRRRR1tdistutils.errorsRRRt!numpy.distutils.command.build_extRR{tnumpy.distutils.ccompilerRRtnumpy.distutils.fcompilerRR tnumpy.distutils.exec_commandR tnumpy.distutilsR tnumpy.distutils.misc_utilR R RR2RRRRRR"R%R'R-R0R:R@RIRKRLRNRORRRSRTRWR[RcRhRrRs(((sA/usr/lib/python2.7/site-packages/numpy/distutils/command/scons.pytsN