B e:d?<e j;d@7_;ejZ?d[dFdGZ>e>e _>e@ZAdHdIZ@e@e _@x8dJD]0ZBejCDdKeBdLZEeEdk reFeEdIe@qWeGZHdMdNZGeGe _GddlIZIeJdOeIjKZLeJdPZMeJdQZNeJdRZOdSdTZPePe _PdS)\)divisionabsolute_importprint_functionN)copy) ccompiler)*)DistutilsExecErrorDistutilsModuleErrorDistutilsPlatformError CompileError)customize_compiler) LooseVersion)log) get_exception) exec_command) cyg2win32 is_sequencemingw32 quote_argsget_num_build_jobs_commandline_dep_stringc Cs|d}tj|sdSt|d}|}WdQRXt|||}|d}||krVdSd|dd} ddtj| dd D} y2t |j } x | D]}t |j | krdSqWWnt k rdSXd S) z Check if an objects needs to be rebuild based on its dependencies Parameters ---------- obj : str object file Returns ------- bool z.dTrNcSs"g|]}|dkr|ds|qS) :)endswith).0xrL/opt/alt/python37/lib64/python3.7/site-packages/numpy/distutils/ccompiler.py Bsz _needs_build..)posixF) ospathexistsopen readlinesrjoinshlexsplitstatst_mtimeOSError) objcc_argsextra_postargspp_optsZdep_fileflinesZcmdlineZ last_cmdlinecontentsZdepsZt_objrrr _needs_build"s&      r5cs:tjddkrtd|}n fdd}t|||dS)Nrcs|f||S)Nr)selfargskw)funcrr Yz replace_method..)sys version_infotypes MethodTypesetattr)klassZ method_namer:mr)r:r replace_methodTs rDcCsdS)z 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. Nr)r7rrr CCompiler_find_executablesbsrEfind_executablescCs|dkr"|}t|r"dt|}t|t|\}}|rt|rRdt|}y t|Wntk rrYnXt d|rd}nd}t d|||fdS)a 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. N zToo many open filesz2 Try rerunning setup command until build succeeds.rz)Command "%s" failed with exit status %d%s) rr(listrinforprint UnicodeErrorresearchr)r7cmddisplaysomsgrrr CCompiler_spawnps"    rSZspawnrc Cs|dkr d}g}x|D]}tjtj|\}}tj|d}|tj|d}|dr|dd}|d|} tjtj | } | ||d}||j krt d||f|rtj|}tj |||j } || qW|S)a 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`. Nrz..z"unknown file type '%s' (from '%s'))r#r$splitextnormpath splitdriveisabs startswithrfindbasenameabspathZsrc_extensionsZUnknownFileErrorr(Z obj_extensionappend) r7Zsource_filenamesZ strip_dir output_dirZ obj_namesZsrc_namebaseextidZobj_namerrr CCompiler_object_filenamess&     rdZobject_filenamesc  spt} ttdkrt| aWdQRX|s0gStjddkrTddlm} m } m } nddl m} m } m } t | rg} x.single_compileZabsoft) rrhrl threadingZ Semaphorer=r>Z fcompilerrerfrgZnumpy.distutils.fcompiler isinstancegetattrr^r( compiler_sorrIZ_setup_compileZ _get_cc_argsrHkeys compiler_typeritemslenZmultiprocessing.poolpoolZ ThreadPoolmapclose)r7Zsourcesr_macros include_dirsdebug extra_preargsr0ZdependsZjobsrerfrgrOZfcZfcompZccompZobjectsZbuildrpZobjects_to_buildZ f77_objectsZ other_objectsr.roraZ build_itemsrQZmultiprocessingryr)r/r0r1r7r CCompiler_compilesh+                  rcompilercstd|jjjjffdd}|dr<|j|drdxjD]\}}|||qLW|drxjD]}| |qtW|dr| |j j |dr| |j j |d r|j|d r|jd S) a 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 zcustomize %s using %scst|ddk o|kS)N)rs)attr)rNignorerr allowssz&CCompiler_customize_cmd..allowr}defineundef libraries library_dirsrpath link_objectsN)rrI __class____name__Zset_include_dirsr}rZ define_macrorZundefine_macroZ set_librariesrZset_library_dirsrZset_runtime_library_dirsrZset_link_objectsr)r7rNrrnamevalueZmacror)rNrr CCompiler_customize_cmd^s&    rZ customize_cmdc Csg}d}t|j}xdD]}||kr||qWx@|D]8}t||r.matcherr)rrrrr)rrrr simple_version_matchsrFc s|st|dr|jS|y |j}Wntk r:dSX|rH|dsLdSy |j}Wn@tk ry |jWntk rdSXfdd}YnXt|dd\}}d}||kr||}|rt|}||_|S)a 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`. rNrcs"t|}|sdS|d}|S)Nr)rLrr)rrCr)rrr rhs   z&CCompiler_get_version..matcher)Zuse_tee) rrrF version_cmdrZ version_matchZversion_patternrr )r7forceZ ok_statusrrZstatusoutputrr)rr CCompiler_get_versionDs2    rrcCs|jdkr|St|}|jdg|jdd|_tjdrrd|jdkrr|jd|jdg|jdd|_n|jdg|jdd|_|S)z Return the C++ compiler. Parameters ---------- None Returns ------- cxx : class instance The C++ compiler, as a `CCompiler` instance. )msvcintelwintelemwrrTNZaixZ ld_so_aixrU)rvrrrtr=platformrZZ linker_so)r7Zcxxrrr CCompiler_cxx_compiler{s rZ cxx_compiler)intelccompilerZIntelCCompilerz(Intel C Compiler for 32-bit applicationsintel)rZIntelItaniumCCompilerz7Intel C Itanium Compiler for Itanium-based applicationsintele)rZIntelEM64TCCompilerz(Intel C Compiler for 64-bit applicationsintelem)rZIntelCCompilerWz3Intel C Compiler for 32-bit applications on Windowsr)rZIntelEM64TCCompilerWz3Intel C Compiler for 64-bit applications on Windowsr)Z pathccompilerZPathScaleCCompilerz2PathScale Compiler for SiCortex-based applicationspathcc))zlinux.*r)zlinux.*r)zlinux.*r)zlinux.*r)ntr)rrZwin32)Zmingw32ccompilerZMingw32CCompilerz>Mingw32 port of GNU C Compiler for Win32(for MSC built Python)rz+Setting mingw32 as default compiler for nt.))rrc CsR|dkrtj}y"|dkr t|}t|\}}}Wn8tk rhd|}|dk r\|d|}t|YnXd|}y t|Wnrtk rtt }t dt||dd}y t|Wn*tk rtt }t d|YnXYnXyt j|} t| |} Wn&tk r2t d||fYnX| d||}t d| |S) Nz5don't know how to compile C/C++ code on platform '%s'z with '%s' compilerznumpy.distutils.z,%s in numpy.distutils; trying from distutilsz4can't compile C/C++ code: unable to load module '%s'zBcan't compile C/C++ code: unable to find class '%s' in module '%s'znew_compiler returns %s)r#rZget_default_compilercompiler_classKeyErrorr __import__ ImportErrorstrrrrIr r=modulesvarsr~) ZplatrverboseZdry_runrZ module_name class_nameZlong_descriptionrRmodulerBrrr new_compilersD         rcCsVt|}t|}t||||}g}x.|D]&}t|rD|t|q(||q(W|S)N)r_distutils_gen_lib_optionsrextendrHr^)rrZruntime_library_dirsrrZlib_optsrbrrr gen_lib_optionss r)Zmsvc9rZ_msvcZbcppZcygwincZemxcZunixcz distutils.rcCst|}t||S)N)r!_distutils_gen_preprocess_options)r|r}rrr gen_preprocess_optionssrz [^\\\'\"%s ]*z'(?:[^'\\]|\\.)*'z"(?:[^"\\]|\\.)*"z\scCs|}g}d}x|rt||}|}|t|krN||d|P||tjkr||d|||d}d}n||dkr|d|||dd}|d}n||dkrt ||}n*||dkrt ||}nt d|||dkrt d||| \}}t||d|drv|d|||d|d||d}|d}n|}|t|kr||PqW|S) Nr\rT'"z!this can't happen (bad char '%c')z"bad string (mismatched %s quotes?)rU)strip _wordchars_rerrrxr^string whitespacelstrip _squote_re _dquote_re RuntimeErrorrspan _has_white_rerM)rPZwordsrrCrZbegrrr split_quoted s@         ,  r)N)rr)NNNrNNN)r)r)rrr)NNrrr)QZ __future__rrrr#rLr=r?r)rkrZ distutilsrZdistutils.ccompilerZdistutils.errorsrr r r Zdistutils.sysconfigr Zdistutils.versionr Znumpy.distutilsrZnumpy.distutils.compatrZnumpy.distutils.exec_commandrZnumpy.distutils.misc_utilrrrrrrrqrZdummy_threadingrlZLockrhsetrir5rDrEZ CCompilerrSrdrrrrrrrrrZ_default_compilersrrIrZ_distutils_new_compilerrrZ_ccrget_mrArrrrrrrrrrrrrr s         2  *  -    ) #  Q  /5      %      /