v]c @`sddlmZmZmZddlZddlZddlZddlZddlZddl Z ddl Z ddl m Z ddl m Z ddlTddlmZmZmZmZddlmZddlmZdd lmZdd lmZdd lmZmZdd lm Z m!Z!m"Z"m#Z#m$Z$yddl%Z%Wne&k riddl'Z%nXda)e%j*Z+e,Z-d Z.dZ/dZ0e/e1de0ddZ2e/e1de2dddZ3e/e1de3ddddddddZ4e/e1de4dMdZ5e/e1de5dZ6dZ7e/e1de7ddZ8e/e1de8dddd Z9e:dgd!Z;e/e1d"e;d#Z<e/e1d$e<dNe=d(dTdUdVdWdXdYf7_>ej?d;krbdZe=d?e _>qbneAZBddddddAZAeAe _AeCZDdBZCeCe _Cx\dCdDdEdFdGdHdIgD]?ZEejFjGdJeEdKZHeHdk reIeHdLeCqqWdS(]i(tdivisiontabsolute_importtprint_functionN(tcopy(t ccompiler(t*(tDistutilsExecErrortDistutilsModuleErrortDistutilsPlatformErrort CompileError(tcustomize_compiler(t LooseVersion(tlog(t get_exception(tfilepath_from_subprocess_outputtforward_bytes_to_stdout(t cyg2win32t is_sequencetmingw32tget_num_build_jobst_commandline_dep_stringc C`s#|d}tjj|s tSt|d}|j}WdQXt|||}|d}||krptSdj|d } gtj | dtD](} | dkr| j d r| ^q} yCtj |j } x*| D]"}tj |j | krtSqWWnt k rtSXtS( s Check if an objects needs to be rebuild based on its dependencies Parameters ---------- obj : str object file Returns ------- bool s.dtrNittposixs t:(tostpathtexiststTruetopent readlinesRtjointshlextsplittendswithtstattst_mtimetOSErrortFalse( tobjtcc_argstextra_postargstpp_optstdep_filetftlinestcmdlinet last_cmdlinetcontentstxtdepstt_obj((si/home/ec2-user/environment/lambda-staging/venv/lib64/python2.7/dist-packages/numpy/distutils/ccompiler.pyt _needs_build%s(   (   c`sNtjddkr+tjd|}nfd}t|||dS(Niic`s|||S(N((tselftargstkw(tfunc(si/home/ec2-user/environment/lambda-staging/venv/lib64/python2.7/dist-packages/numpy/distutils/ccompiler.pyt\R(tsyst version_infottypest MethodTypetNonetsetattr(tklasst method_nameR8tm((R8si/home/ec2-user/environment/lambda-staging/venv/lib64/python2.7/dist-packages/numpy/distutils/ccompiler.pytreplace_methodWscC`sdS(s Does nothing here, but is called by the get_version method and can be overridden by subclasses. In particular it is redefined in the `FCompiler` class where more documentation can be found. N((R5((si/home/ec2-user/environment/lambda-staging/venv/lib64/python2.7/dist-packages/numpy/distutils/ccompiler.pytCCompiler_find_executablesestfind_executablescC`s|dkr9|}t|r9djt|}q9ntj|ytj|WnDtjk r}|j }|j }n!t k rd}d}nXdSt|rdjt|}nt |t jd|rd}nd}td|||fdS(s Execute a command in a sub-process. Parameters ---------- cmd : str The command to execute. display : str or sequence of str, optional The text to add to the log file kept by `numpy.distutils`. If not given, `display` is equal to `cmd`. Returns ------- None Raises ------ DistutilsExecError If the command failed, i.e. the exit status was not 0. t RisToo many open filess2 Try rerunning setup command until build succeeds.s)Command "%s" failed with exit status %d%sN(R>RRtlistR tinfot subprocesst check_outputtCalledProcessErrortoutputt returncodeR%RtretsearchR(R5tcmdtdisplaytexctotstmsg((si/home/ec2-user/environment/lambda-staging/venv/lib64/python2.7/dist-packages/numpy/distutils/ccompiler.pytCCompiler_spawnss,          tspawnRc C`sG|dkrd}ng}x%|D]}tjjtjj|\}}tjj|d}|tjj|}|jdr|jdd}|| } tjj tjj | } | ||}n||j krt d||fn|rtjj |}ntjj |||j} |j| q"W|S(s Return the name of the object files for the given source files. Parameters ---------- source_filenames : list of str The list of paths to source files. Paths can be either relative or absolute, this is handled transparently. strip_dir : bool, optional Whether to strip the directory from the returned paths. If True, the file name prepended by `output_dir` is returned. Default is False. output_dir : str, optional If given, this path is prepended to the returned paths to the object files. Returns ------- obj_names : list of str The list of paths to the object files corresponding to the source files in `source_filenames`. Ris..is"unknown file type '%s' (from '%s')N(R>RRtsplitexttnormpatht splitdrivetisabst startswithtrfindtbasenametabspathtsrc_extensionstUnknownFileErrorRt obj_extensiontappend( R5tsource_filenamest strip_dirt output_dirt obj_namestsrc_nametbasetexttitdtobj_name((si/home/ec2-user/environment/lambda-staging/venv/lib64/python2.7/dist-packages/numpy/distutils/ccompiler.pytCCompiler_object_filenamess&   $ tobject_filenamesc `sVt} t#tdkr.tj| anWdQX|s>gStjddkrpddlm } m } m } nddl m } m } m } t | rg} x\dddgD]K}td |}|dkrqn| jd |d j|fqWd j| } nj}d d j|f} tj| j|||||\}}}j||dd j} r| dd j7} ntj| fd}t | rt|j}gg}}x|D]}||kr ||\}}jdkrYt|}t|}n| |r| | r|j|||ffq|j|||ffq q W|}x'|D]}||qWn |j}t|dkr7| dkr7ddl}|jj| }|j|||j nx|D]}||q>W|S(s Compile one or more source files. Please refer to the Python distutils API reference for more details. Parameters ---------- sources : list of str A list of filenames output_dir : str, optional Path to the output directory. macros : list of tuples A list of macro definitions. include_dirs : list of str, optional The directories to add to the default include file search path for this compilation only. debug : bool, optional Whether or not to output debug symbols in or alongside the object file(s). extra_preargs, extra_postargs : ? Extra pre- and post-arguments. depends : list of str, optional A list of file names that all targets depend on. Returns ------- objects : list of str A list of object file names, one per source file `sources`. Raises ------ CompileError If compilation fails. Niii(t FCompilert is_f_filethas_f90_headertf77tf90tfixt compiler_sFortran %s compiler: %sRFs sC compiler: %s scompile options: '%s's extra options: '%s'c `s|\}\}}t|s+dSxAtrnt"|tkrXtj|PnWdQXtjdq.Wz-t!j|||WdQXWdttj |WdQXXdS(Ng?( R4Rt _global_lockt_processing_filestaddttimetsleept_job_semaphoret_compiletremove(R6R'tsrcRj(R(R)R*R5(si/home/ec2-user/environment/lambda-staging/venv/lib64/python2.7/dist-packages/numpy/distutils/ccompiler.pytsingle_compile/s    &tabsoft(!RRwR|R>t threadingt SemaphoreR:R;t fcompilerRpRqRrtnumpy.distutils.fcompilert isinstancetgetattrRcRt compiler_soR RHt_setup_compilet _get_cc_argsRGtkeyst compiler_typeRtitemstlentmultiprocessing.pooltpoolt ThreadPooltmaptclose(R5tsourcesRftmacrost include_dirstdebugt extra_preargsR)tdependstjobsRpRqRrRQtfctfcomptccomptobjectstbuildRtobjects_to_buildt f77_objectst other_objectsR'RRjt build_itemsRStmultiprocessingR((R(R)R*R5si/home/ec2-user/environment/lambda-staging/venv/lib64/python2.7/dist-packages/numpy/distutils/ccompiler.pytCCompiler_compilesh+   $             tcompilec`sKtjd|jjjjffd}|drT|jjn|drx*jD]\}}|j||qjWn|drx!jD]}|j |qWn|dr|j |j j n|dr |j |j j n|dr(|jjn|d rG|jjnd S( s Customize compiler using distutils command. Parameters ---------- cmd : class instance An instance inheriting from `distutils.cmd.Command`. ignore : sequence of str, optional List of `CCompiler` commands (without ``'set_'``) that should not be altered. Strings that are checked for are: ``('include_dirs', 'define', 'undef', 'libraries', 'library_dirs', 'rpath', 'link_objects')``. Returns ------- None scustomize %s using %sc`s"t|ddk o!|kS(N(RR>(tattr(RPtignore(si/home/ec2-user/environment/lambda-staging/venv/lib64/python2.7/dist-packages/numpy/distutils/ccompiler.pytallowsRtdefinetundeft librariest library_dirstrpatht link_objectsN(R RHt __class__t__name__tset_include_dirsRRt define_macroRtundefine_macrot set_librariesRtset_library_dirsRtset_runtime_library_dirsRtset_link_objectsR(R5RPRRtnametvaluetmacro((RPRsi/home/ec2-user/environment/lambda-staging/venv/lib64/python2.7/dist-packages/numpy/distutils/ccompiler.pytCCompiler_customize_cmdrs&       t customize_cmdc C`sg}d}t|jj}xHdddddddd d d g D]"}||krF|j|qFqFWx]|D]U}t||rst||}t|t|}|j|t|fqsqsWd t|d d}g|D]}||^q}dj |S(NitversionRRt object_switchtcompile_switchRRRRRs%-iss = %ss ( RGt executablesRRcthasattrRtmaxRtreprR( tcompilertpropstmxRtkeytvtfmttpropR-((si/home/ec2-user/environment/lambda-staging/venv/lib64/python2.7/dist-packages/numpy/distutils/ccompiler.pyt_compiler_to_strings     cC`sty|jWntk r!nXtjjdkrptddt|jtt|tddndS(s Print the compiler customizations to stdout. Parameters ---------- None Returns ------- None Notes ----- Printing is only done if the distutils log threshold is < 2. iRiPN(t get_versiont ExceptionR t _global_logt thresholdtprintRR(R5((si/home/ec2-user/environment/lambda-staging/venv/lib64/python2.7/dist-packages/numpy/distutils/ccompiler.pytCCompiler_show_customizations  tshow_customizationc C`sftjd|jjt||r6y|jjdWnttfk rTnXt |drd|j dkr|j s3|j dj drd\}}n d\}}|j dj ||g|j d |_ q3q6t |dr tjd |j fnt |d s6tjd |jjq6nt |drd|j dks~d|j dks~d |j dkrt|_ntjdkrbddl}ddl}|j}zyptjj|d}t|d} | jdWdQX|j|gd|ddd|dgt|_Wntk rLt|_nXWd|j|XndS(sm Do any platform-specific customization of a compiler instance. This method calls `distutils.sysconfig.customize_compiler` for platform-specific customization, as well as optionally remove a flag to suppress spurious warnings in case C++ code is being compiled. Parameters ---------- dist : object This parameter is not used for anything. need_cxx : bool, optional Whether or not C++ has to be compiled. If so (True), the ``"-Wstrict-prototypes"`` option is removed to prevent spurious warnings. Default is False. Returns ------- None Notes ----- All the default options used by distutils can be extracted with:: from distutils import sysconfig sysconfig.get_config_vars('CC', 'CXX', 'OPT', 'BASECFLAGS', 'CCSHARED', 'LDSHARED', 'SO') s customize %ss-Wstrict-prototypesRtccitgccsg++sc++is#### %s #######t compiler_cxxsMissing compiler_cxx fix for tclangRNsfile.ctwsint a; RfRs-MMDs-MFs.d(Rsg++(Rsc++(R RHRRR RR~tAttributeErrort ValueErrorRRRR\treplacetwarnRt _auto_dependsRRttempfiletshutiltmkdtempRRRtwriteRR R&trmtree( R5tdisttneed_cxxtatbRRttmpdirtfnR,((si/home/ec2-user/environment/lambda-staging/venv/lib64/python2.7/dist-packages/numpy/distutils/ccompiler.pytCCompiler_customizesL "  "      t customizes[-.\d]+c`sfd}|S(sU Simple matching of version numbers, for use in CCompiler and FCompiler. Parameters ---------- pat : str, optional A regular expression matching version numbers. Default is ``r'[-.\d]+'``. ignore : str, optional A regular expression matching patterns to skip. Default is ``''``, in which case nothing is skipped. start : str, optional A regular expression matching the start of where to start looking for version numbers. Default is ``''``, in which case searching is started at the beginning of the version string given to `matcher`. Returns ------- matcher : callable A function that is appropriate to use as the ``.version_match`` attribute of a `CCompiler` class. `matcher` takes a single parameter, a version string. c`s|jdd}d}rItj|}|s:dS|j}nx^trtj||}|srdSrtj|jdr|j}qLnPqLW|jdS(Ns RFi(RRNtmatchR>tendRROtgroup(R5tversion_stringtposRB(Rtpattstart(si/home/ec2-user/environment/lambda-staging/venv/lib64/python2.7/dist-packages/numpy/distutils/ccompiler.pytmatcherAs  ! ((RRRR((RRRsi/home/ec2-user/environment/lambda-staging/venv/lib64/python2.7/dist-packages/numpy/distutils/ccompiler.pytsimple_version_match'sc `si| rt|dr|jS|jy |j}Wntk rHdSX| s[|d r_dSy |j}WnBtk ry |jWntk rdSXfd}nXytj |dtj }WnDtj k r}|j }|j }n/tk rd}d}nXt|}d}d}||kr\||}|r\t|}q\n||_|S(s Return compiler version, or None if compiler is not available. Parameters ---------- force : bool, optional If True, force a new determination of the version, even if the compiler already has a version attribute. Default is False. ok_status : list of int, optional The list of status values returned by the version look-up process for which a version string is returned. If the status value is not in `ok_status`, None is returned. Default is ``[0]``. Returns ------- version : str or None Version string, in the format of `distutils.version.LooseVersion`. Ric`s/tj|}|sdS|jd}|S(NR(RNRR>R(RRBR(R(si/home/ec2-user/environment/lambda-staging/venv/lib64/python2.7/dist-packages/numpy/distutils/ccompiler.pyRzs tstderriRN(RRREt version_cmdRR>t version_matchtversion_patternRIRJtSTDOUTRKRLRMR%RR ( R5tforcet ok_statusRRRLRRtstatusR((Rsi/home/ec2-user/environment/lambda-staging/venv/lib64/python2.7/dist-packages/numpy/distutils/ccompiler.pytCCompiler_get_versionVsD               RcC`s|jd kr|St|}|jdg|jd|_tjjdrd|jdkr|jd|jdg|jd|_n|jdg|jd|_|S( s Return the C++ compiler. Parameters ---------- None Returns ------- cxx : class instance The C++ compiler, as a `CCompiler` instance. tmsvctintelwtintelemwiitaixt ld_so_aixi(RRR(RRRRR:tplatformR\t linker_so(R5tcxx((si/home/ec2-user/environment/lambda-staging/venv/lib64/python2.7/dist-packages/numpy/distutils/ccompiler.pytCCompiler_cxx_compilers %t cxx_compilertintelccompilertIntelCCompilers(Intel C Compiler for 32-bit applicationstinteltIntelItaniumCCompilers7Intel C Itanium Compiler for Itanium-based applicationstinteletIntelEM64TCCompilers(Intel C Compiler for 64-bit applicationstintelemtIntelCCompilerWs3Intel C Compiler for 32-bit applications on WindowsRtIntelEM64TCCompilerWs3Intel C Compiler for 64-bit applications on WindowsRt pathccompilertPathScaleCCompilers2PathScale Compiler for SiCortex-based applicationstpathccslinux.*tnttwin32tmingw32ccompilertMingw32CCompilers>Mingw32 port of GNU C Compiler for Win32(for MSC built Python)Rs+Setting mingw32 as default compiler for nt.c C`s|dkrtj}ny2|dkr6t|}nt|\}}}WnDtk rd|}|dk r|d|}nt|nXd|}yt|Wntk r,t t }t j dt ||d}yt|Wq-tk r(t t }t d|q-XnXy!tj|} t| |} Wn+tk r{t dd||fnX| d||}t jd | |S( Ns5don't know how to compile C/C++ code on platform '%s's with '%s' compilersnumpy.distutils.s,%s in numpy.distutils; trying from distutilsis4can't compile C/C++ code: unable to load module '%s's4can't compile C/C++ code: unable to find class '%s' sin module '%s'snew_compiler returns %s(R>RRtget_default_compilertcompiler_classtKeyErrorRt __import__t ImportErrortstrR R RHRR:tmodulestvarsR( tplatRtverbosetdry_runRt module_namet class_nametlong_descriptionRUtmoduleR@((si/home/ec2-user/environment/lambda-staging/venv/lib64/python2.7/dist-packages/numpy/distutils/ccompiler.pyt new_compilersD              cC`s_t||||}g}x=|D]5}t|rJ|jt|q"|j|q"W|S(N(t_distutils_gen_lib_optionsRtextendRGRc(RRtruntime_library_dirsRRtlib_optsRk((si/home/ec2-user/environment/lambda-staging/venv/lib64/python2.7/dist-packages/numpy/distutils/ccompiler.pytgen_lib_optionss    tmsvc9Rt_msvctbcpptcygwinctemxctunixcs distutils.RR+((RRs(Intel C Compiler for 32-bit applications(RR s7Intel C Itanium Compiler for Itanium-based applications(RR s(Intel C Compiler for 64-bit applications(RRs3Intel C Compiler for 32-bit applications on Windows(RRs3Intel C Compiler for 64-bit applications on Windows(RRs2PathScale Compiler for SiCortex-based applications(slinux.*R (slinux.*R (slinux.*R (slinux.*R(RR(RR(RRs>Mingw32 port of GNU C Compiler for Win32(for MSC built Python)(RR((RR(Jt __future__RRRRRNR:R<R RzRIRt distutilsRtdistutils.ccompilertdistutils.errorsRRRR tdistutils.sysconfigR tdistutils.versionR tnumpy.distutilsR tnumpy.distutils.compatR tnumpy.distutils.exec_commandRRtnumpy.distutils.misc_utilRRRRRRRtdummy_threadingR>R|tLockRwtsetRxR4RCRDt CCompilerRVRnRRRRRRR&RRRt_default_compilersRRHR&t_distutils_new_compilerR+R't_ccRtgett_mR?(((si/home/ec2-user/environment/lambda-staging/venv/lib64/python2.7/dist-packages/numpy/distutils/ccompiler.pyts        "(    2   ;-  )  # Q/C             %   "