2[c @`sqddlmZmZmZddlZddlZddlZddlZddlZddl Z ddl m Z ddl m Z ddl TddlmZmZmZmZddlmZddlmZdd lmZdd lmZdd lmZdd lmZmZm Z m!Z!m"Z"m#Z#yddl$Z$Wne%k r]ddl&Z$nXda(e$j)Z*e+Z,d Z-dZ.dZ/e.e0de/ddZ1e.e0de1dddZ2e.e0de2ddddddddZ3e.e0de3dSdZ4e.e0de4dZ5dZ6e.e0de6ddZ7e.e0de7dddd Z8e9dgd!Z:e.e0d"e:d#Z;e.e0d$e;dTe<d(d;krVd`e<d?Ys(tsyst version_infottypest MethodTypetNonetsetattr(tklasst method_nameR8tm((R8s8/tmp/pip-build-fiC0ax/numpy/numpy/distutils/ccompiler.pytreplace_methodTscC`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((s8/tmp/pip-build-fiC0ax/numpy/numpy/distutils/ccompiler.pytCCompiler_find_executablesbstfind_executablescC`s|dkr9|}t|r9djt|}q9ntj|t|\}}|rt|rdjt|}nyt|Wntk rnXt j d|rd}nd}t d|||fndS(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 sToo many open filess2 Try rerunning setup command until build succeeds.Rs)Command "%s" failed with exit status %d%sN( R>RRtlistR tinfoRtprintt UnicodeErrortretsearchR(R5tcmdtdisplaytstotmsg((s8/tmp/pip-build-fiC0ax/numpy/numpy/distutils/ccompiler.pytCCompiler_spawnps"      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((s8/tmp/pip-build-fiC0ax/numpy/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'tsrcRf(R(R)R*R5(s8/tmp/pip-build-fiC0ax/numpy/numpy/distutils/ccompiler.pytsingle_compiles    &tabsoft(!RRsRxR>t threadingt SemaphoreR:R;t fcompilerRlRmRntnumpy.distutils.fcompilert isinstancetgetattrR_Rt compiler_soR RHt_setup_compilet _get_cc_argsRGtkeyst compiler_typeRtitemstlentmultiprocessing.pooltpoolt ThreadPooltmaptclose(R5tsourcesRbtmacrost include_dirstdebugt extra_preargsR)tdependstjobsRlRmRnRNtfctfcomptccomptobjectstbuildR|tobjects_to_buildt f77_objectst other_objectsR'R{Rft build_itemsRPtmultiprocessingR((R(R)R*R5s8/tmp/pip-build-fiC0ax/numpy/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(RMtignore(s8/tmp/pip-build-fiC0ax/numpy/numpy/distutils/ccompiler.pytallowssRtdefinetundeft 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(R5RMRRtnametvaluetmacro((RMRs8/tmp/pip-build-fiC0ax/numpy/numpy/distutils/ccompiler.pytCCompiler_customize_cmd^s&       t customize_cmdc C`sg}d}t|jj}xHdddddddd d d g D]"}||krF|j|qFqFWx]|D]U}t||rst||}t|t|}|j|t|fqsqsWg}d t|d d}x|D]}|j||qWdj |S(NitversionRRt object_switchtcompile_switchRRRRRs%-iss = %ss ( RGt executablesRR_thasattrRtmaxRtreprR( tcompilertpropstmxRtkeytvR-tformattprop((s8/tmp/pip-build-fiC0ax/numpy/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 thresholdRIRR(R5((s8/tmp/pip-build-fiC0ax/numpy/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; RbRs-MMDs-MFs.d(Rsg++(Rsc++(R RHRRR RRztAttributeErrort ValueErrorRRRRXtreplacetwarnRt _auto_dependsRRttempfiletshutiltmkdtempRRRtwriteRR R&trmtree( R5tdisttneed_cxxtatbRRttmpdirtfnR,((s8/tmp/pip-build-fiC0ax/numpy/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(RRKtmatchR>tendRRLtgroup(R5tversion_stringtposRB(Rtpattstart(s8/tmp/pip-build-fiC0ax/numpy/numpy/distutils/ccompiler.pytmatcher/s  ! ((RRRR((RRRs8/tmp/pip-build-fiC0ax/numpy/numpy/distutils/ccompiler.pytsimple_version_matchsc`s | rt|dr|jS|jy |j}Wntk rHdSX| s[|d r_dSy |j}WnBtk ry |jWntk rdSXfd}nXt|dd\}}d}||kr||}|rt |}qn||_|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(RKRR>R(RRBR(R(s8/tmp/pip-build-fiC0ax/numpy/numpy/distutils/ccompiler.pyRhs tuse_teeN( RRREt version_cmdRR>t version_matchtversion_patternRR (R5tforcet ok_statusRRtstatustoutputR((Rs8/tmp/pip-build-fiC0ax/numpy/numpy/distutils/ccompiler.pytCCompiler_get_versionDs2          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:tplatformRXt linker_so(R5tcxx((s8/tmp/pip-build-fiC0ax/numpy/numpy/distutils/ccompiler.pytCCompiler_cxx_compiler{s %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_descriptionRQtmoduleR@((s8/tmp/pip-build-fiC0ax/numpy/numpy/distutils/ccompiler.pyt new_compilersD              cC`swt|}t|}t||||}g}x=|D]5}t|rb|jt|q:|j|q:W|S(N(Rt_distutils_gen_lib_optionsRtextendRGR_(RRtruntime_library_dirsRRtlib_optsRg((s8/tmp/pip-build-fiC0ax/numpy/numpy/distutils/ccompiler.pytgen_lib_optionss      tmsvc9Rt_msvctbcpptcygwinctemxctunixcs distutils.RR&cC`st|}t||S(N(Rt!_distutils_gen_preprocess_options(RR((s8/tmp/pip-build-fiC0ax/numpy/numpy/distutils/ccompiler.pytgen_preprocess_optionss s [^\\\'\"%s ]*s'(?:[^'\\]|\\.)*'s"(?:[^"\\]|\\.)*"s\scC`s|j}g}d}x|rtj||}|j}|t|krf|j|| Pn||tjkr|j|| ||j}d}n(||dkr|| ||d}|d}n||dkrt j||}n9||dkr t j||}nt d|||dkrWt d||n|j\}}tj||d|d!r|| ||d|d!||}|jd}n |j}|t|kr|j|PqqW|S( Nis\it't"s!this can't happen (bad char '%c')s"bad string (mismatched %s quotes?)i(tstript _wordchars_reRRRR_tstringt whitespacetlstript _squote_ret _dquote_ret RuntimeErrorR>Rtspant _has_white_reRL(ROtwordsRRBRtbeg((s8/tmp/pip-build-fiC0ax/numpy/numpy/distutils/ccompiler.pyt split_quoted s@      %  ((RRs(Intel C Compiler for 32-bit applications(RRs7Intel C Itanium Compiler for Itanium-based applications(RRs(Intel C Compiler for 64-bit applications(RR s3Intel C Compiler for 32-bit applications on Windows(RR s3Intel C Compiler for 64-bit applications on Windows(R R s2PathScale 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(St __future__RRRRRKR:R<R RvRt distutilsRtdistutils.ccompilertdistutils.errorsRRRR tdistutils.sysconfigR tdistutils.versionR tnumpy.distutilsR tnumpy.distutils.compatR tnumpy.distutils.exec_commandRtnumpy.distutils.misc_utilRRRRRRR~Rtdummy_threadingR>RxtLockRstsetRtR4RCRDt CCompilerRRRjRRRRRRR&RRRt_default_compilersRRHR!t_distutils_new_compilerR&R"t_ccRtgett_mR?R.R-R3RR4R2R6R7R:R=(((s8/tmp/pip-build-fiC0ax/numpy/numpy/distutils/ccompiler.pyts       ".    2   *-  )  # Q/5             %  "     /