a :jg] @s^ddlZddlZddlZddlZddlZddlZddlZddlZddlZddl Z ddl Z ddl Z ddl mZddlmZddlZddlmZeZgZddZeegdZGdd d Zd d Zd d ZddZddZdddZddZ dddZ!ddZ"ddZ#ddZ$dd d!Z%dd"d#Z&d$d%Z'e'r\e(dd&d'd(d)d*d+d,d-d. Z)dd0d1Z*n dd2d1Z*d3d4Z+d5d6Z,d7d8Z-d9d:Z.d;d<Z/d=d>Z0e1e1d?d@dAZ2dBdCZ3dDdEZ4dFdGZ5dHdIZ6e7dJej8j9Z:e7dKej8j9Z;e7dLej8j9ZdPdQZ?dRdSZ@dTdUZAdVdWZBdXdYZCdZd[ZDd\d]ZEd^d_ZFd`daZGdbdcZHdddeZIdfdgZJdhdiZKdjdkZLdldmZMdndoZNdpdqZOdrdsZPdtduZQddvdwZRdxdyZSdzd{ZTdd|d}ZUGd~ddZVifddZWddZXddZYdddZZdddZ[ddZ\dddZ]ddZ^ddZ_ddZ`ddZaddZbddhZcddZdddZedS)N)local)reduce)DistutilsErrorc Cs8tdur4tD]&}zt|Wq ty0Yq 0q dSN)_tmpdirsshutilrmtreeOSError)dr C/usr/local/lib/python3.9/site-packages/numpy/distutils/misc_util.pyclean_up_temporary_directorys  r )* Configurationget_numpy_include_dirsdefault_config_dict dict_append appendpathgenerate_config_pyget_cmdallpath get_mathlibsterminal_has_colorsred_text green_text yellow_text blue_text cyan_text cyg2win32mingw32 all_strings has_f_sourceshas_cxx_sourcesfilter_sourcesget_dependenciesis_local_src_dirget_ext_source_filesget_script_filesget_lib_source_filesget_data_filesdot_join get_frame minrelpathnjoin is_sequence is_stringas_listgpaths get_languageget_build_architectureget_info get_pkg_infoget_num_build_jobssanitize_cxx_flagsexec_mod_from_locationc@seZdZdZddZdS)InstallableLiba Container to hold information on an installable library. Parameters ---------- name : str Name of the installed library. build_info : dict Dictionary holding build information. target_dir : str Absolute path specifying where to install the library. See Also -------- Configuration.add_installed_library Notes ----- The three parameters are stored as attributes with the same names. cCs||_||_||_dSr)name build_info target_dir)selfr9r:r;r r r __init__FszInstallableLib.__init__N)__name__ __module__ __qualname____doc__r=r r r r r80sr8cCsddlm}zttd}Wnty8t}Yn0t|d}t tj d|}|}|durh|St | dddt | dddt | d ddf}td d |Dr|Std d |DSdS) a Get number of parallel build jobs set by the --parallel command line argument of setup.py If the command did not receive a setting the environment variable NPY_NUM_BUILD_JOBS is checked. If that is unset, return the number of processors on the system, with a maximum of 8 (to prevent overloading the system if there a lot of CPUs). Returns ------- out : int number of parallel jobs that can be run rget_distributionZNPY_NUM_BUILD_JOBSNbuildparallel build_ext build_clibcss|]}|duVqdSrr .0xr r r kz%get_num_build_jobs..css|]}|dur|VqdSrr rIr r r rLnrM)numpy.distutils.corerClenossched_getaffinityAttributeErrormultiprocessing cpu_countminintenvirongetgetattrget_command_objallmax)rCrTZenvjobsdistZcmdattrr r r r5Ls"   r5cCs^ddl}|jdtddt|}tt|D],}||}d|vr,|ddvr,d|||<q,|S) z8Quote list of arguments. .. deprecated:: 1.22. rNz"quote_args" is deprecated. stacklevel z"'z"%s")warningswarnDeprecationWarninglistrangerO)argsrbiar r r quote_argspsrjcCs|d}tjj|S)zDConvert a /-separated pathname to one using the OS's path separator./)splitrPpathjoin)r9rlr r r rs rcCstjtj|}tjtj|}t|t|kr<|S||krHdS||dt|kr|t|tjfvsJt||t|f|t|dd}|S)z$Return path relative to parent_path.N)rPrmrealpathabspathrOseprepr)rm parent_pathpdZapathr r r rel_paths,rwcCsz(td|j|j}tjtj|}Wnbtytd|j|j}t|t j |}t |drztjtj|j }n tjd}Yn0|durt ||}|pdS)zReturn path of the module given a frame object from the call stack. Returned path is relative to parent_path when given, otherwise it is absolute path. __file__r>.N)eval f_globalsf_localsrPrmdirnamerr NameError __import__sysmoduleshasattrrxrw)frameruZ caller_filer Z caller_namemodr r r get_path_from_frames    rcGszg}|D]2}t|r$|t|qt|s0J||q|}|sJd}n tjj|}tjjdkrr|dtjj}t |S)a2Join two or more pathname components + - convert a /-separated pathname to one using the OS's path separator. - resolve `..` and `.` from path. Either passing n arguments as in njoin('a','b'), or a sequence of n names as in njoin(['a','b']) is handled, or a mixture of such arguments. rork) r-appendr,r.rPrmrnrsreplacer+)rmpathspZjoinedr r r r,s    r,c Cs|durtj|d}n@t}|D]&}tj|d}tj|r"|}qXq"td|ft|T}g}d}|D]6}||rn|t|d }|rn| | dqnWdn1s0Y|S)z/Return the MATHLIB line from numpyconfig.h Nz_numpyconfig.hz1_numpyconfig.h not found in numpy include dirs %rz#define MATHLIB,) rPrmrnrexistsropen startswithrOstripextendrl) rm config_filedirsfnfidZmathlibsslinevaluer r r rs(   0rcCst|s |Sd|vr|S|tj}|rXz|dd}WntyNYqXYn0||=q$d}|rz|d|}WntyYqYn0||ddkr|d7}q\||=||d=d}q\|sdStj|S)z$Resolve `..` and '.' from path. ryrpz..ro)r.rlrPrsindex ValueErrorrn)rmlrhjr r r r+s0      r+cCstt|S)z}sorts output of python glob for https://bugs.python.org/issue30461 to allow extensions to have reproducible build results)sortedglob)Zfileglobr r r sorted_globsrcCsJt|sJtt|g}t|r0Jt||D]}t|rd|vsTd|vrt|}tt||}|rz||n.|r||n|r||td||fnft||}t j |r||nDt j |r||n|r||t j |s:td||fq4t|r0|t |||q4||q4dd|DS)N*?z#could not resolve pattern in %r: %rznon-existing path in %r: %rcSsg|] }t|qSr )r+rJrr r r -rMz_fix_paths..) r-rttyper.rr,rrprintrPrmr _fix_paths)r local_pathinclude_non_existingZ new_pathsnrZp2Zn2r r r r s@             rroTcCst|r|f}t|||S)z:Apply glob to paths and prepend local_path if needed. )r.r)rrrr r r r0/sr0cCsLttds tt_ttjtj||tj|d\}}t |d}||fS)Ntempdir)suffixprefixdirtextw) r_tdatatempfilemkdtemprrrmkstemprPfdopen)rrrrr9for r r make_temp_file6s     rcCstjdkrdtjvrdSttjdrtjrz|ddl}|| ddkr| ddkr| ddurx| ddus| d dur| d dus| d durWd SWnt yYn0dS) NcygwinZ USE_COLORrisattycolorspairsZsetfZsetbZsetafZsetabZscprp) rplatformrPrWrstdoutrcursesZ setuptermZtigetnumZtigetstr Exception)rr r r rCs.         rrpr^ ) blackredgreenyellowbluemagentacyanwhitedefaultFcCs|g}|r|d|r8dt|d}|t||r^dt|d}|t||rtdd||fS|SdS)N1r(rz [%sm%s;)r _colour_codesrXlowerstrrn)rfgbgboldseqZfgcodeZbgcoder r r colour_textas rcCs|Srr )rrrr r r rpscCs t|dS)Nrrrr r r default_textssrcCs t|dS)Nrrrr r r rusrcCs t|dS)Nrrrr r r rwsrcCs t|dS)Nrrrr r r rysrcCs t|dS)Nrrrr r r r{srcCs t|dS)Nrrrr r r r}sr)rmreturncCs"tjdkr|Stjdd|gddS)a(Convert a path from Cygwin-native to Windows-native. Uses the cygpath utility (part of the Base install) to do the actual conversion. Falls back to returning the original path if this fails. Handles the default ``/cygdrive`` mount prefix as well as the ``/proc/cygdrive`` portable prefix, custom cygdrive prefixes such as ``/`` or ``/mnt``, and absolute paths such as ``/usr/src/`` or ``/home/username`` Parameters ---------- path : str The path to convert Returns ------- converted_path : str The converted path Notes ----- Documentation for cygpath utility: https://cygwin.com/cygwin-ug-net/cygpath.html Documentation for the C function it wraps: https://cygwin.com/cygwin-api/func-cygwin-conv-path.html rz/usr/bin/cygpathz --windowsT)r)rr subprocess check_output)rmr r r rs   rcCs:tjdkr6tjdddkr dStjdddkr6dSdS) z0Return true when using mingw32 environment. win32ZOSTYPEroZmsysTZMSYSTEMZMINGW32F)rrrPrWrXr r r r rs  rcCs8tjd}|dkr0ttj|d|d}nd}|S)zGReturn version of MSVC runtime library, as defined by __MSC_VER__ macrozMSC v.r N)rversionfindrV)Zmsc_posZmsc_verr r r msvc_runtime_versions  rcCs,t}|r$|dkrd|Sd|SndSdS)zFReturn name of MSVC runtime library if Python was built with MSVC >= 7zmsvcr%iz vcruntime%iN)msvc_runtime_major)verr r r msvc_runtime_librarys  rcCs dddddddtd}|S) zFReturn major version of MSVC runtime coded like get_build_msvc_versionFGPZdr)iiixii@ilN)rXr)majorr r r rsrz.*\.(cpp|cxx|cc)\Zz.*\.(f90|f95|f77|for|ftn|f)\Zz.*\.(f90|f95)\Zz\s*module\s*(?P[\w_]+)cCsft|s gSg}t|:}|D]$}t|}|r|d}||qWdn1sX0Y|S)zRReturn a list of Fortran f90 module names that given source file defines. r9N) f90_ext_matchrf90_module_name_matchgroupr)sourcerfrmr9r r r _get_f90_moduless  *rcCs t|tSr) isinstancerrr r r r.sr.cCs|D]}t|sdSqdS)z4Return True if all items in lst are string objects. FTr.)lstitemr r r rsrcCs2t|r dSz t|Wnty,YdS0dS)NFT)r.rOrrr r r r-s  r-cCst|od|vpd|vS)Nrrrrr r r is_glob_patternsrcCst|rt|S|gSdSr)r-rerr r r r/sr/cCs:d}|D],}t|trt|r(d}q6qt|rd}q|S)z2Determine language value (c,f77,f90) from sources Nf90f77)rrrfortran_ext_match)sourceslanguagerr r r r1s r1cCs|D]}t|rdSqdS)z.Return True if sources contains Fortran files TF)rrrr r r r sr cCs|D]}t|rdSqdS)z*Return True if sources contains C++ files TF) cxx_ext_matchrr r r r!sr!cCspg}g}g}g}|D]N}t|rDt|}|r8||qb||qt|rX||q||q||||fS)ztReturn four lists of filenames containing C, C++, Fortran, and Fortran 90 module sources, respectively. )rrrr)rZ c_sourcesZ cxx_sourcesZ f_sourcesZfmodule_sourcesrrr r r r"s    r"cCs.g}|D] }ttj|d}||q|S)Nz*.h)rrPrmrnr)Zdirectory_listheadersr headr r r _get_headers5s  rcCsDg}|D]6}tj|}|ddkr|d|vr||dq|S)Nrro)rPrmrlr)Zlist_of_sourcesZdirecsrr r r r _get_directories=s  rcCs6d}|d|7}|d|7}|d|d7}|S)zb Return commandline representation used to determine if a file needs to be recompiled z commandline: ra rn)Zcc_argsZextra_postargsZpp_optsZcmdliner r r _commandline_dep_stringFs rcCs tt|Sr)rr)rr r r r#Rsr#cCst|s dStj|}tjt|g}|t|dtj}|r\|ds\|dd}|rp|ddkrpdStj |}tj |S)z1Return true if directory is local directory. FNrrprE) r.rPrmrr commonprefixgetcwdrOrlrsrnisdir) directoryZabs_dircZnew_dirr r r r$Vs    r$c#svddddtd}tj|ddD]L\}}}fdd|D}||dd<|D]}||sPtj||VqPq$dS)NrpCVS.svnrE(?:[~#]|\.py[co]|\.o)$Ttopdowncsg|]}|vr|qSr r rJr pruned_directoriesr r rirMz(general_source_files..)recompilerPwalksearchrmrn)top_pathprune_file_patdirpathdirnames filenamesprunedrr rr general_source_fileses    r!c #sgdtdtj|ddD]\}}}fdd|D}||dd<|D]h}tj||t|}g}tD]2}tj|} tj| rv | sv| | qv||fVqLq |t|}fddtD}d d|D}||fVdS) zJReturn a directory name relative to top_path and files contained. rrTrcsg|]}|vr|qSr r rrr r rvrMz4general_source_directories_files..Ncs$g|]}|stj|qSr )rrPrmrnrJr)dpathrr r rs cSsg|]}tj|r|qSr )rPrmisfiler"r r r rrM) rrrPrrmrnrwlistdirr$rr) rrrrr r rpathfilesrrr )r#rrr general_source_directories_filesos&     r(cCsng}dd|jD}|||t||jD]6}t|rR|tt|q2tj |r2| |q2|S)NcSsg|]}t|r|qSr rrJ_mr r r rrMz(get_ext_source_files..) rrr#dependsr$rer!rPrmr$r)extrrr r r r r%s    r%cCsdd|D}|S)NcSsg|]}t|r|qSr rr)r r r rrMz$get_script_files..r )scriptsr r r r&sr&cCsg}|ddg}dd|D}|||t||ddg}|D]6}t|rn|tt|qNtj|rN| |qN|S)NrprcSsg|]}t|r|qSr rr)r r r rrMz(get_lib_source_files..r+) rXrr#r$rer!rPrmr$r)librrr+r r r r r's   r'cCstj}|dd}|s|tjds2tjdr8d}nDtjdrJd}n2tjdr\d }n d |vr||d |d dd }|S) aReturn the correct file extension for shared libraries. Parameters ---------- is_python_ext : bool, optional Whether the shared library is a Python extension. Default is False. Returns ------- so_ext : str The shared library extension. Notes ----- For Python shared libs, `so_ext` will typically be '.so' on Linux and OS X, and '.pyd' on Windows. For Python >= 3.2 `so_ext` has a tag prepended on POSIX systems according to PEP 3149. EXT_SUFFIXrolinuxZ gnukfreebsdz.sodarwinz.dylibwinz.dllSOABIryrp) distutils sysconfigget_config_varsrXrrrr)Z is_python_extZconfvarsZso_extr r r get_shared_lib_extensions      r7cCst|r|gS|d}g}|D]d}t|dr.qt|rJ|tt|qt|rvtj|rj| |qt d|qt t |q|S)Nrp__call__zNot existing data file:) r.rr$rrer!rPrmr$rr TypeErrorrt)datarrrr r r r(s    r(cGsddd|DS)NrycSsg|] }|r|qSr r )rJrir r r rrMzdot_join..r)rgr r r r)sr)cCsRzt|dWStyLtdj}t|dD] }|j}q8|YS0dS)z:Return frame object from call stack with given level. rpr^N)r _getframerRexc_infotb_framerff_back)levelr_r r r r*s r*c@sneZdZgdZddgZddgZgZdXd d Zd d Zd dZ ddZ ddZ ddZ dYddZ dZddZd[ddZd\ddZddZd d!Zd"d#Zd$d%Zd&d'Zd(d)Zd*d+Zd,d-Zd.d/Zd0d1Zd2d3Zd]d4d5Zd^d6d7Zd8d9Zd:d;Zdd?Z!d@dAZ"dBdCZ#dDdEZ$dFdGZ%dHdIZ&dJdKZ'd_dLdMZ(d`dOdPZ)dadQdRZ*dbdTdUZ+dVdWZ,dS)cr) packages ext_modules data_files include_dirs librariesrr- py_modulesinstalled_libraries define_macros package_dirinstalled_pkg_configr9rNrpsetup.pyc Kst|||_d|_t|}t|||_|dur:|j}d|_|durJ|j}n tjt |j|rjt |j|}tj|pvdst d|f||_ ||_ tjj |jd|_|jdd|_|jdd|_|jD]&} t|| g} t|| t| q|jD]"} t|| i} t|| | q|j|j} |jdd|_|D]h} | | vrXqF|| } t|| | t| tr|j| n&t| tr|j| n |j| qFtjt |dr|j |j||j!|j<tddddd|_"d} t#dd D]b}z t|}Wnt y*YqbYn0zt$d |j%|j&} WqbWnt'y\Yn0qt| |j(r| j"d r|j)fi| j"||_*dS) aConstruct configuration instance of a package. package_name -- name of the package Ex.: 'distutils' parent_name -- name of the parent package Ex.: 'numpy' top_path -- directory of the toplevel package Ex.: the directory where the numpy package source sits package_path -- directory of package. Will be computed by magic from the directory of the caller module if not specified Ex.: the directory where numpy.distutils is caller_level -- frame level to caller namespace, internal parameter. Nroryz%r is not a directory __init__.pyF)ignore_setup_xxx_pyassume_default_configurationdelegate_options_to_subpackagesquietrprr<rO)+r)r9rr*rrrPrmr r,rr package_pathrnrlpath_in_package _list_keys list_keys _dict_keys dict_keyscopyrXsetattrr/ _extra_keys extra_keyskeysrrerdictrrArIoptionsrfrzr{r|r~ __class__ set_options setup_name)r< package_name parent_namerrQ caller_levelr`attrsZ caller_framerv known_keysriZcaller_instancerhrr r r r=sx                zConfiguration.__init__cCsB|i}|j|j|j}|D]}t||}|r"|||<q"|S)z Return a dictionary compatible with the keyword arguments of distutils setup function. Examples -------- >>> setup(**config.todict()) #doctest: +SKIP )_optimize_data_filesrTrVrZrY)r<r rfrrir r r todictbs   zConfiguration.todictcCs|jdst|dS)NrP)r]rr<messager r r infous zConfiguration.infocCstjd|fdS)Nz Warning: %s )rstderrwriterir r r rcyszConfiguration.warncKs8|D]*\}}||jvr&||j|<qtd|qdS)z Configure Configuration instance. The following options are available: - ignore_setup_xxx_py - assume_default_configuration - delegate_options_to_subpackages - quiet zUnknown option: N)itemsr]r)r<r]keyrr r r r_|s   zConfiguration.set_optionscCsddlm}|S)z2Return the distutils distribution object for self.rrB)rNrC)r<rCr r r rCs zConfiguration.get_distributionc Cs|d}t|jg|}ddt|D}g}|D]h}tjt|dsLq4d|tjvr^q4d|tjt | d} |j | ||dd} | | q4|S)NrycSsg|]}tj|r|qSr )rPrmr r)r r r rrMz:Configuration._wildcard_get_subpackage..rLrErprbrc) rlr,rrrPrmr$rsrnrOget_subpackager) r<subpackage_namerbrcrsubpackage_pathr config_listr rr r r r _wildcard_get_subpackages    z&Configuration._wildcard_get_subpackagec Cstjdtj|ztjtj|d}t|j||}t d | d|}t |ds|j dsv|d|t|||j||dd} nFt|g| ddd } | f} |jjjdkr| |jf} |j| } | jt||kr|d t||| jfWtjd=n tjd=0| S) Nrr@ry configurationrNzCAssuming default configuration (%s does not define configuration())rprcrz*Subpackage %r configuration returned as %r)rrminsertrPr}splitextbasenamer)r9r7rnrlrr]rcrrrv__code__ co_argcount) r<setup_pyrrrsrbrcr`rZ setup_moduleconfigZpnrgr r r _get_configuration_from_setup_pys6    z.Configuration._get_configuration_from_setup_pycCsV|dur$|durtdtj|}|d}|durRd|vrR|j|||ddSd|vslJt|||f|durt|jg|}n&t|g|dd}| |gd}t||j }|j d stj |st|d |}tj |s*|j d s| d tj||ft|||j||dd}n|j|||||dd}|rN|gSgSdS) aReturn list of subpackage configurations. Parameters ---------- subpackage_name : str or None Name of the subpackage to get the configuration. '*' in subpackage_name is handled as a wildcard. subpackage_path : str If None, then the path is assumed to be the local path plus the subpackage_name. If a setup.py file is not found in the subpackage_path, then a default configuration is used. parent_name : str Parent name. Nz;either subpackage_name or subpackage_path must be specifiedryrrprwrrrMz setup_%s.pyrNzEAssuming default configuration (%s/{setup_%s,setup}.py was not found))rrPrmrzrlrurtr,rrr`r]r$rcr}rrr)r<rrrsrbrcrr}r~r r r rqsT      zConfiguration.get_subpackageFc Cs|r d}n|j}|j|||dd}|s0|d|D]^}|}t|trN|}t|tshJtt|| d| d|jf|j fi|q4| }|dur|d|dS)aAdd a sub-package to the current Configuration instance. This is useful in a setup.py script for adding sub-packages to a package. Parameters ---------- subpackage_name : str name of the subpackage subpackage_path : str if given, the subpackage path such as the subpackage is in subpackage_path / subpackage_name. If None,the subpackage is assumed to be located in the local path / subpackage_name. standalone : bool Nr^rpz0No configuration returned, assuming unavailable.z Appending %s configuration to %sr9zTdistutils distribution has been initialized, it may be too late to add a subpackage ) r9rqrcrrrhr\rtrrkrXrrC) r<rrrs standalonerbrtr~r r]r r r add_subpackages.  zConfiguration.add_subpackagec st|r|\}ndt|r6fdd|DdSt|sLtd|fdurtj|rvtj||fS||fSj|dd}t |rt rt  tj }| ttt|d}| |D]}||s||=q|D]}tj|std|qt|j}| tj }| g} d }|D]z} t | r~|t|krntd |f| ||n4| ||ksJt| |||||f| | |d7}qB||drވd ||f| tj | |fqn|D]}|fqdSt r4Jt} | durZ| jdurZ| j} nj} |D]>}tt|D]*\} }tjj| }| ||fqtqddS) aRecursively add files under data_path to data_files list. Recursively add files under data_path to the list of data_files to be installed (and distributed). The data_path can be either a relative path-name, or an absolute path-name, or a 2-tuple where the first argument shows where in the install directory the data directory should be installed to. Parameters ---------- data_path : seq or str Argument can be either * 2-sequence (, ) * path to data directory where python datadir suffix defaults to package dir. Notes ----- Rules for installation paths:: foo/bar -> (foo/bar, foo/bar) -> parent/foo/bar (gun, foo/bar) -> parent/gun foo/* -> (foo/a, foo/a), (foo/b, foo/b) -> parent/foo/a, parent/foo/b (gun, foo/*) -> (gun, foo/a), (gun, foo/b) -> gun (gun/*, foo/*) -> parent/gun/a, parent/gun/b /foo/bar -> (bar, /foo/bar) -> parent/bar (gun, /foo/bar) -> parent/gun (fun/*/gun/*, sun/foo/bar) -> parent/fun/foo/gun/bar Examples -------- For example suppose the source directory contains fun/foo.dat and fun/bar/car.dat: >>> self.add_data_dir('fun') #doctest: +SKIP >>> self.add_data_dir(('sun', 'fun')) #doctest: +SKIP >>> self.add_data_dir(('gun', '/full/path/to/fun'))#doctest: +SKIP Will install data-files to the locations:: / fun/ foo.dat bar/ car.dat sun/ foo.dat bar/ car.dat gun/ foo.dat car.dat Ncsg|]}|fqSr ) add_data_dirrr r<r r rkrMz.Configuration.add_data_dir..znot a string: %rFrrpzNot a directory, skippingrzcannot fill pattern %r with %rz,mismatch of pattern_list=%s and path_list=%s)r-r.r9rPrmisabsrrzrrrrlrsreversererfrOr rrwrrrrtrcrnrCrCr(rR)r<Z data_pathr pattern_listZrlrhrmr& path_list target_listrr]rCZd1r target_pathr rr r.st8         *  zConfiguration.add_data_dircCs^i}|jD]2\}}||vr$t||<|D]}|||q(q dd|D|jdd<dS)NcSsg|]\}}|t|fqSr )re)rJrr'r r r rrMz6Configuration._optimize_data_files..)rCsetaddrn)r<Z data_dictrr'rr r r rgs z"Configuration._optimize_data_filescGs(t|dkr$|D]}||qdSt|dks4Jt|drN|d\}}nd}t|r`|}nLt|rt|dkr~|d}q|D]}|||fqdSnttt||durt|drd}ntj |rd}n tj |}|||fdS|j |dd}t |rt |r|tj}||D]}|tj}||g} d} |D]2} t | r| || | d7} n | | qZ| |tj| |fq.n|||fdSt |rJt||f|} | dur| jdur| j} n|j} | tj |j||fdS)aAdd data files to configuration data_files. Parameters ---------- files : sequence Argument(s) can be either * 2-sequence (,) * paths to data files where python datadir prefix defaults to package dir. Notes ----- The form of each element of the files sequence is very flexible allowing many combinations of where to get the files from the package and where they should ultimately be installed on the system. The most basic usage is for an element of the files argument sequence to be a simple filename. This will cause that file from the local path to be installed to the installation path of the self.name package (package path). The file argument can also be a relative path in which case the entire relative path will be installed into the package directory. Finally, the file can be an absolute path name in which case the file will be found at the absolute path name but installed to the package path. This basic behavior can be augmented by passing a 2-tuple in as the file argument. The first element of the tuple should specify the relative path (under the package install directory) where the remaining sequence of files should be installed to (it has nothing to do with the file-names in the source distribution). The second element of the tuple is the sequence of files that should be installed. The files in this sequence can be filenames, relative paths, or absolute paths. For absolute paths the file will be installed in the top-level package installation directory (regardless of the first argument). Filenames and relative path names will be installed in the package install directory under the path name given as the first element of the tuple. Rules for installation paths: #. file.txt -> (., file.txt)-> parent/file.txt #. foo/file.txt -> (foo, foo/file.txt) -> parent/foo/file.txt #. /foo/bar/file.txt -> (., /foo/bar/file.txt) -> parent/file.txt #. ``*``.txt -> parent/a.txt, parent/b.txt #. foo/``*``.txt`` -> parent/foo/a.txt, parent/foo/b.txt #. ``*/*.txt`` -> (``*``, ``*``/``*``.txt) -> parent/c/a.txt, parent/d/b.txt #. (sun, file.txt) -> parent/sun/file.txt #. (sun, bar/file.txt) -> parent/sun/file.txt #. (sun, /foo/bar/file.txt) -> parent/sun/file.txt #. (sun, ``*``.txt) -> parent/sun/a.txt, parent/sun/b.txt #. (sun, bar/``*``.txt) -> parent/sun/a.txt, parent/sun/b.txt #. (sun/``*``, ``*``/``*``.txt) -> parent/sun/c/a.txt, parent/d/b.txt An additional feature is that the path to a data-file can actually be a function that takes no arguments and returns the actual path(s) to the data-files. This is useful when the data files are generated while building the package. Examples -------- Add files to the list of data_files to be included with the package. >>> self.add_data_files('foo.dat', ... ('fun', ['gun.dat', 'nun/pun.dat', '/tmp/sun.dat']), ... 'bar/cat.dat', ... '/full/path/to/can.dat') #doctest: +SKIP will install these data files to:: / foo.dat fun/ gun.dat nun/ pun.dat sun.dat bar/ car.dat can.dat where is the package (or sub-package) directory such as '/usr/lib/python2.4/site-packages/mypackage' ('C: \Python2.4 \Lib \site-packages \mypackage') or '/usr/lib/python2.4/site- packages/mypackage/mysubpackage' ('C: \Python2.4 \Lib \site-packages \mypackage \mysubpackage'). rpNrr8roFr)rOadd_data_filesr-r.r9rtrrrPrmrr}rrrlrsrpoprrnrCrCrR)r<r'rr Zfilepatrrrmrrrhrr]rCr r r rsfX              zConfiguration.add_data_filescCs>|}|dur.t|ds g|_|j|n |j|dS)zAdd define macros to configuration Add the given sequence of macro name and value duples to the beginning of the define_macros list This list will be visible to all extension modules of the current package. NrH)rCrrHr)r<macrosr]r r r add_define_macrosIs  zConfiguration.add_define_macroscGsH||}|}|dur8|jdur*g|_|j|n |j|dS)zAdd paths to configuration include directories. Add the given sequence of paths to the beginning of the include_dirs list. This list will be visible to all extension modules of the current package. N)rrCrDr)r<rrDr]r r r add_include_dirsYs  zConfiguration.add_include_dirscsg|D]ltr0fddDqtttfrJtdkrVttfdddDq}|dur|j durg|_ |j n j dS)aAdd installable headers to configuration. Add the given sequence of files to the beginning of the headers list. By default, headers will be installed under // directory. If an item of files is a tuple, then its first argument specifies the actual installation location relative to the path. Parameters ---------- files : str or seq Argument(s) can be either: * 2-sequence (,) * path(s) to header file(s) where python includedir suffix will default to package name. csg|]}j|fqSr )rr9r)rr<r r r~rMz-Configuration.add_headers..r^csg|]}d|fqSr)rr)rrmr r rrMrpN) r.rrtuplererOr9rtrCrr)r<r'r]r )rrmr<r add_headersis   zConfiguration.add_headerscOs|dd}t||j|dS)aApply glob to paths and prepend local_path if needed. Applies glob.glob(...) to each path in the sequence (if needed) and pre-pends the local_path if needed. Because this is called on all source lists, this allows wildcard characters to be specified in lists of sources for extension modules and libraries and scripts and allows path-names be relative to the source directory. rT)rr)rXr0r)r<rkwsrr r r rs zConfiguration.pathscCs4|D]&}||}|dvr||}|||<qdS)N)rr+rD library_dirsZ module_dirs extra_objects)r[r)r<kwkrenew_vr r r _fix_paths_dicts   zConfiguration._fix_paths_dictcKst|}t|j||d<||d<d|vrx|d}|d=t|trH|g}|D]*}t|tsfJt|t|fi|qL|||dg}g}g|d<|D]} t| t r|| dd| vrt| dd\} } t j t|j| } t j | rt|jd| dd } t| tr| } d d | dgDD]@} | d dd }|| kr0| ddt|fi| qq0q|| q||d|d<|j|dg|d<d dlm}|fi|}|j||}|dur|d||S)aAdd extension to configuration. Create and add an Extension instance to the ext_modules list. This method also takes the following optional keyword arguments that are passed on to the Extension constructor. Parameters ---------- name : str name of the extension sources : seq list of the sources. The list of sources may contain functions (called source generators) which must take an extension instance and a build directory as inputs and return a source file or list of source files or None. If None is returned then no sources are generated. If the Extension instance has no sources after processing all source generators, then no extension module is built. include_dirs : define_macros : undef_macros : library_dirs : libraries : runtime_library_dirs : extra_objects : extra_compile_args : extra_link_args : extra_f77_compile_args : extra_f90_compile_args : export_symbols : swig_opts : depends : The depends list contains paths to files or directories that the sources of the extension module depend on. If any path in the depends list is newer than the extension module, then the module will be rebuilt. language : f2py_options : module_dirs : extra_info : dict or list dict or list of dict of keywords to be appended to keywords. Notes ----- The self.paths(...) method is applied to all lists that may contain paths. r9r extra_inforErp@Nr^rwcSsg|] }|dqSrr )rJrr r r rrMz/Configuration.add_extension..Z__OF__rrH ExtensionzTdistutils distribution has been initialized, it may be too late to add an extension )rWr)r9rr\rtrrrXrrlrPrmrrr,rr rqrrhrrrHrNrrBrCrc)r<r9rrZext_argsrrkrEZlibnamesZlibnamelnameZlpathr rZllnamerr,r]r r r add_extensions^0             zConfiguration.add_extensioncKs2|||d||}|dur.|d|dS)a Add library to configuration. Parameters ---------- name : str Name of the extension. sources : sequence List of the sources. The list of sources may contain functions (called source generators) which must take an extension instance and a build directory as inputs and return a source file or list of source files or None. If None is returned then no sources are generated. If the Extension instance has no sources after processing all source generators, then no extension module is built. build_info : dict, optional The following keys are allowed: * depends * macros * include_dirs * extra_compiler_args * extra_f77_compile_args * extra_f90_compile_args * f2py_options * language NzQdistutils distribution has been initialized, it may be too late to add a library ) _add_libraryrCrc)r<r9rr:r]r r r add_library s zConfiguration.add_librarycCs@t|}||d<d|vr"g|d<|||j||fdS)z\Common implementation for add_library and add_installed_library. Do not use directlyrr+N)rWrrErr<r9r install_dirr:r r r r-s   zConfiguration._add_librarycCs@|si}tj|j|}||||||jt|||dS)aS Similar to add_library, but the specified library is installed. Most C libraries used with ``distutils`` are only used to build python extensions, but libraries built through this method will be installed so that they can be reused by third-party packages. Parameters ---------- name : str Name of the installed library. sources : sequence List of the library's source files. See `add_library` for details. install_dir : str Path to install the library, relative to the current sub-package. build_info : dict, optional The following keys are allowed: * depends * macros * include_dirs * extra_compiler_args * extra_f77_compile_args * extra_f90_compile_args * f2py_options * language Returns ------- None See Also -------- add_library, add_npy_pkg_config, get_info Notes ----- The best way to encode the options required to link against the specified C libraries is to use a "libname.ini" file, and use `get_info` to retrieve the required options (see `add_npy_pkg_config` for more information). N)rPrmrnrQrrGrr8rr r r add_installed_library=s ,z#Configuration.add_installed_librarycCsZ|dur i}tj|j|}|j|jvrB|j|j|||fn|||fg|j|j<dS)a# Generate and install a npy-pkg config file from a template. The config file generated from `template` is installed in the given install directory, using `subst_dict` for variable substitution. Parameters ---------- template : str The path of the template, relatively to the current package path. install_dir : str Where to install the npy-pkg config file, relatively to the current package path. subst_dict : dict, optional If given, any string of the form ``@key@`` will be replaced by ``subst_dict[key]`` in the template file when installed. The install prefix is always available through the variable ``@prefix@``, since the install prefix is not easy to get reliably from setup.py. See also -------- add_installed_library, get_info Notes ----- This works for both standard installs and in-place builds, i.e. the ``@prefix@`` refer to the source directory for in-place builds. Examples -------- :: config.add_npy_pkg_config('foo.ini.in', 'lib', {'foo': bar}) Assuming the foo.ini.in file has the following content:: [meta] Name=@foo@ Version=1.0 Description=dummy description [default] Cflags=-I@prefix@/include Libs= The generated file will have the following content:: [meta] Name=bar Version=1.0 Description=dummy description [default] Cflags=-Iprefix_dir/include Libs= and will be installed as foo.ini in the 'lib' subpath. When cross-compiling with numpy distutils, it might be necessary to use modified npy-pkg-config files. Using the default/generated files will link with the host libraries (i.e. libnpymath.a). For cross-compilation you of-course need to link with target libraries, while using the host Python installation. You can copy out the numpy/_core/lib/npy-pkg-config directory, add a pkgdir value to the .ini files and set NPY_PKG_CONFIG_PATH environment variable to point to the directory with the modified npy-pkg-config files. Example npymath.ini modified for cross-compilation:: [meta] Name=npymath Description=Portable, core math library implementing C99 standard Version=0.1 [variables] pkgname=numpy._core pkgdir=/build/arm-linux-gnueabi/sysroot/usr/lib/python3.7/site-packages/numpy/_core prefix=${pkgdir} libdir=${prefix}/lib includedir=${prefix}/include [default] Libs=-L${libdir} -lnpymath Cflags=-I${includedir} Requires=mlib [msvc] Libs=/LIBPATH:${libdir} npymath.lib Cflags=/INCLUDE:${includedir} Requires=mlib N)rPrmrnrQr9rJr)r<templaterZ subst_dictr r r add_npy_pkg_configps_ z Configuration.add_npy_pkg_configcGsH||}|}|dur8|jdur*g|_|j|n |j|dS)zAdd scripts to configuration. Add the sequence of files to the beginning of the scripts list. Scripts will be installed under the /bin/ directory. N)rrCr-r)r<r'r-r]r r r add_scriptss  zConfiguration.add_scriptsc Ks|jD] }t||}|||gq|jD] }t||}|||iq.|j|j|j}|D]}||vrt||d}|r|||krqj|d||||ddft |||||j |qj||jvr| d|t||||fqj||vrqjt d|qjdS)Nz"Inheriting attribute %r=%r from %rr9rz*Ignoring attempt to set %r (from %r to %r)zDon't know about key=%r) rTrYrrXrVupdaterZr[rcrXrrkr)r<r\rorirfr r r rs.        zConfiguration.dict_appendcCsvddlm}|j|j|j}d}|d|jd7}||D](}t||d}|r@|d|||f7}q@|d7}|S)Nr)pformatz<----- zConfiguration of z: z%s = %s z----->)pprintrrTrVrZr9sortrY)r<rrfrrrir r r __str__s  zConfiguration.__str__cCsJtd}|d|_d|_tjd}|rFtjd|g}|tjd<|S)zF Returns the numpy.distutils config command instance. r~rPATHry) rensure_finalizedZ dump_sourceZnoisyrPrWrXpathseprn)r<cmdold_pathrmr r r get_config_cmds  zConfiguration.get_config_cmdcCstd}||jS)zh Return a path to a temporary directory where temporary files should be placed. rE)rr build_temp)r<rr r r get_build_temp_dirsz Configuration.get_build_temp_dircCsd}|}|j|dd}|S)aSCheck for availability of Fortran 77 compiler. Use it inside source generating function to ensure that setup distribution instance has been initialized. Notes ----- True if a Fortran 77 compiler is available (because a simple Fortran 77 code was able to be compiled successfully). / subroutine simple end rlangrZ try_compiler<Zsimple_fortran_subroutineZ config_cmdflagr r r have_f77c(s zConfiguration.have_f77ccCsd}|}|j|dd}|S)aRCheck for availability of Fortran 90 compiler. Use it inside source generating function to ensure that setup distribution instance has been initialized. Notes ----- True if a Fortran 90 compiler is available (because a simple Fortran 90 code was able to be compiled successfully) rrrrrr r r have_f90c;s zConfiguration.have_f90ccCsft|r$|\}}t||j|jdn>ddlm}t||sFJt||j|j|j|jdS)zEAppend libraries, include_dirs to extension or library item. )rErDrrN) r-rrErDrNrrrtr)r<ZextlibZlib_namer:rr r r append_toNs zConfiguration.append_toc Csztjdg|d}Wntjtfy,Yn 0td|}|rLt|dStj dkrrt j ddrrt |dd }n t |d d }t j|r t|}|}Wdn1s0Y|dd d krtd |}|rt|dSn td|}|r t|dSdS)z+Return path's SVN revision number. Z svnversioncwd(?P\d+)revisionrZSVN_ASP_DOT_NET_HACKNZ_svnentriesrrz\d+)"zdir[\n\r]+(?P\d+))rrCalledProcessErrorr rmatchrVrrrrPrWrXr,rmr$rreadr)r<rmoutputrrrZfstrr r r _get_svn_revision\s*   &  zConfiguration._get_svn_revisionc Cs@ztjgd|d}Wntjtfy.Yn 0td|}|rNt|dSt|dd}t|dd}t j |r_version.py, version.py, and __svn_version__.py for string variables version, __version__, and _version, until a version number is found. rNz__version__.pyryrz _version.pyz version.py__svn_version__.py__hg_version__.py __version___version)z.pyUrprr@)rYr9rlr,rrPrmr$ryrzr)r7rn ImportErrorrcr get_versionsrRrrr)r<Z version_fileZversion_variablerr'Z version_varsrrrkr9rZversion_moduleerirr r r get_versionsh              zConfiguration.get_versionTcsVtjdjtjs,dur0dSfdd}d|fdS)aAppends a data function to the data_files list that will generate __svn_version__.py file to the current package directory. Generate package __svn_version__.py file from SVN revision number, it will be removed after python exits but will be available when sdist, etc commands are executed. Notes ----- If __svn_version__.py existed before, nothing is done. This is intended for working with source directories that are in an SVN repository. rNcstjs^t}d|ftd}|d|Wdn1sT0Yjffdd }t|S)NCreating %s (version=%r)r version = %r cslrhzt||d|Wnty0Yn0z"t|d|d|dWntyfYn0dSNzremoved r rPremover rrdeleter r rm_files $zSConfiguration.make_svn_version_py..generate_svn_version_py..rm_file rPrmr$rrkrrmatexitregisterrrrrrr<targetr r generate_svn_version_pys  , zBConfiguration.make_svn_version_py..generate_svn_version_pyro)r,rrrPrmr$r)r<rrr rr make_svn_version_pys   z!Configuration.make_svn_version_pycsVtjdjtjs,dur0dSfdd}d|fdS)aAppends a data function to the data_files list that will generate __hg_version__.py file to the current package directory. Generate package __hg_version__.py file from Mercurial revision, it will be removed after python exits but will be available when sdist, etc commands are executed. Notes ----- If __hg_version__.py existed before, nothing is done. This is intended for working with source directories that are in an Mercurial repository. rNcstjs^t}d|ftd}|d|Wdn1sT0Yjffdd }t|S)Nrrrcslrhzt||d|Wnty0Yn0z"t|d|d|dWntyfYn0dSrrrrr r r/s $zQConfiguration.make_hg_version_py..generate_hg_version_py..rm_filerrrr r generate_hg_version_py(s  , z@Configuration.make_hg_version_py..generate_hg_version_pyro)r,rrrPrmr$r)r<rrr rr make_hg_version_pys   z Configuration.make_hg_version_py __config__cCs|j|j|tfdS)zGenerate package __config__.py file containing system_info information used during building the package. This file is installed to the package installation directory. N)rFrr9r)r<r9r r r make_config_py<szConfiguration.make_config_pycGs6ddlm}m}i}|D]}||fi||q|S)zGet resources information. Return information (from system_info.get_info) for all of the names in the argument list in a single dictionary. rp)r3r) system_infor3r)r<namesr3rZ info_dictrir r r r3Fs zConfiguration.get_info)NNNNrprK)rp)rp)NNrp)NF)N)N)NN)T)T)r)-r>r?r@rSrUrYnumpy_include_dirsr=rhrkrcr_rCrurrqrrrgrrrrrrrrrrrrrrrrrrrrrrrrrr3r r r r rsp a  " > +y "g$ 3 k  & L ) ( rcCsN||vrFddl}|jj}|dur4ddlm}|d||}|||<||S)Nr)DistutilsInternalErrorz+setup distribution instance not initialized)distutils.corecore_setup_distributiondistutils.errorsrrZ)Zcmdname_cacher4r]rrr r r rSs  rcCs(tjdd}|s$ddl}|g}|S)Nr)rrnumpyZ get_include)rDrr r r r_s  rcCsDtjd}|dur|Stjd}tjtj|j ddd}|S)aReturn the path where to find the npy-pkg-config directory. If the NPY_PKG_CONFIG_PATH environment variable is set, the value of that is returned. Otherwise, a path inside the location of the numpy module is returned. The NPY_PKG_CONFIG_PATH can be useful when cross-compiling, maintaining customized npy-pkg-config .ini files for the cross-compilation environment, and using them when cross-compiling. ZNPY_PKG_CONFIG_PATHNrZ_corer.znpy-pkg-config) rPrWrX importlibutil find_specrmrnr}origin)r specr r r get_npy_pkg_dirhs  rcCs0ddlm}|r|tntg}|||S)a Return library info for the given package. Parameters ---------- pkgname : str Name of the package (should match the name of the .ini file, without the extension, e.g. foo for the file foo.ini). dirs : sequence, optional If given, should be a sequence of additional directories where to look for npy-pkg-config files. Those directories are searched prior to the NumPy directory. Returns ------- pkginfo : class instance The `LibraryInfo` instance containing the build information. Raises ------ PkgNotFound If the package is not found. See Also -------- Configuration.add_npy_pkg_config, Configuration.add_installed_library, get_info r) read_config)numpy.distutils.npy_pkg_configrrr)pkgnamerrr r r r4|s  r4cCsfddlm}t||}||}||D]\}}|||q2|d|d<|d=|d=|S)a; Return an info dict for a given C library. The info dict contains the necessary options to use the C library. Parameters ---------- pkgname : str Name of the package (should match the name of the .ini file, without the extension, e.g. foo for the file foo.ini). dirs : sequence, optional If given, should be a sequence of additional directories where to look for npy-pkg-config files. Those directories are searched prior to the NumPy directory. Returns ------- info : dict The dictionary with build information. Raises ------ PkgNotFound If the package is not found. See Also -------- Configuration.add_npy_pkg_config, Configuration.add_installed_library, get_pkg_info Examples -------- To get the necessary information for the npymath library from NumPy: >>> npymath_info = np.distutils.misc_util.get_info('npymath') >>> npymath_info #doctest: +SKIP {'define_macros': [], 'libraries': ['npymath'], 'library_dirs': ['.../numpy/_core/lib'], 'include_dirs': ['.../numpy/_core/include']} This info dict can then be used as input to a `Configuration` instance:: config.add_extension('foo', sources=['foo.c'], extra_info=npymath_info) r) parse_flagsrrHZignored)rrr4cflagsZlibsrnr)rrrpkg_inforkrrer r r r3s-    r3cCs.ddl}z |jWdSty(YdS0dS)NrTF)builtinsZ__NUMPY_SETUP__rR)rr r r is_bootstrappings  rcCs:ddl}|jd||||||fddt|||}|S)zqReturn a configuration dictionary for usage in configuration() function defined in file setup_.py. rNzXUse Configuration(%r,%r,top_path=%r) instead of deprecated default_config_dict(%r,%r,%r)r^r_)rbrcrrh)r9rbrrbr r r r rs rcKsR|D]D\}}||vrD||}t|tr4|||<qL|||q|||<qdSr)rnrrr)r rrreovr r r rs  rcCs,tjjdkr,|dtjj}|dtjj}d}tj|rtj|d}tjtj|d}tj|\}}tj||g}tj|dt ||t |d|kstj|dt ||t |d|krtj |}|t |d}tj|r|dd}n|}tj t |||S)Nrkrorrp) rPrmrsrr splitdriverrr rnrOr}normpathr,)rrmdriveZ absprefixZ pathdriver subpathr r r r s$ *( rcCsddlm}ddlm}|tj|t|d}|dtj t j d|d|d|t d|jD]\}}|d ||fq~|t d Wd n1s0Y|S) zGenerate config.py file containing system_info information used during building the package. Usage: config['py_modules'].append((packagename, '__config__',generate_config_py)) r)r)mkpathrz'# This file is generated by numpy's %s zH# It contains system_info results at the time of building this package. z__all__ = ["get_info","show"] a import os import sys extra_dll_dir = os.path.join(os.path.dirname(__file__), '.libs') if sys.platform == 'win32' and os.path.isdir(extra_dll_dir): os.add_dll_directory(extra_dll_dir) z%s=%r a~ def get_info(name): g = globals() return g.get(name, g.get(name + "_info", {})) def show(): """ Show libraries in the system on which NumPy was built. Print information about various resources (libraries, library directories, include directories, etc.) in the system on which NumPy was built. See Also -------- get_include : Returns the directory containing NumPy C header files. Notes ----- 1. Classes specifying the information to be printed are defined in the `numpy.distutils.system_info` module. Information may include: * ``language``: language used to write the libraries (mostly C or f77) * ``libraries``: names of libraries found in the system * ``library_dirs``: directories containing the libraries * ``include_dirs``: directories containing library header files * ``src_dirs``: directories containing library source files * ``define_macros``: preprocessor macros used by ``distutils.setup`` * ``baseline``: minimum CPU features required * ``found``: dispatched features supported in the system * ``not found``: dispatched features that are not supported in the system 2. NumPy BLAS/LAPACK Installation Notes Installing a numpy wheel (``pip install numpy`` or force it via ``pip install numpy --only-binary :numpy: numpy``) includes an OpenBLAS implementation of the BLAS and LAPACK linear algebra APIs. In this case, ``library_dirs`` reports the original build time configuration as compiled with gcc/gfortran; at run time the OpenBLAS library is in ``site-packages/numpy.libs/`` (linux), or ``site-packages/numpy/.dylibs/`` (macOS), or ``site-packages/numpy/.libs/`` (windows). Installing numpy from source (``pip install numpy --no-binary numpy``) searches for BLAS and LAPACK dynamic link libraries at build time as influenced by environment variables NPY_BLAS_LIBS, NPY_CBLAS_LIBS, and NPY_LAPACK_LIBS; or NPY_BLAS_ORDER and NPY_LAPACK_ORDER; or the optional file ``~/.numpy-site.cfg``. NumPy remembers those locations and expects to load the same libraries at run-time. In NumPy 1.21+ on macOS, 'accelerate' (Apple's Accelerate BLAS library) is in the default build-time search order after 'openblas'. Examples -------- >>> import numpy as np >>> np.show_config() blas_opt_info: language = c define_macros = [('HAVE_CBLAS', None)] libraries = ['openblas', 'openblas'] library_dirs = ['/usr/local/lib'] """ from numpy._core._multiarray_umath import ( __cpu_features__, __cpu_baseline__, __cpu_dispatch__ ) for name,info_dict in globals().items(): if name[0] == "_" or type(info_dict) is not type({}): continue print(name + ":") if not info_dict: print(" NOT AVAILABLE") for k,v in info_dict.items(): v = str(v) if k == "sources" and len(v) > 200: v = v[:60] + " ...\n... " + v[-60:] print(" %s = %s" % (k,v)) features_found, features_not_found = [], [] for feature in __cpu_dispatch__: if __cpu_features__[feature]: features_found.append(feature) else: features_not_found.append(feature) print("Supported SIMD extensions in this NumPy install:") print(" baseline = %s" % (','.join(__cpu_baseline__))) print(" found = %s" % (','.join(features_found))) print(" not found = %s" % (','.join(features_not_found))) N)Znumpy.distutils.system_infordistutils.dir_utilr rPrmr}rrmrzrargvtextwrapdedentZ saved_resultsrn)rrr rrrhr r r r s      .drcCs|jdkstd|j|jS)zdReturn version major and minor of compiler instance if it is MSVC, raise an exception otherwise.Zmsvcz"Compiler instance is not msvc (%s)) compiler_typerZ_MSVCCompiler__version)compilerr r r msvc_version s  rcCsddlm}|S)Nrr2)Zdistutils.msvccompilerr2rr r r r2 s r2z%-Werror=implicit-function-declarationz-std=c99cCsdd|DS)z= Some flags are valid for C but not C++. Prune them. cSsg|]}|tvr|qSr )_cxx_ignore_flags)rJrr r r r rMz&sanitize_cxx_flags..r )Zcxxflagsr r r r6 sr6cCs*tj||}tj|}|j||S)z Use importlib machinery to import a module `modname` from the file `modfile`. Depending on the `spec.loader`, the module may not be registered in sys.modules. )rrspec_from_file_locationmodule_from_specloader exec_module)modnameZmodfilerZfoor r r r7 s  r7)N)N)roT)roroT)NNF)NN)F)r)N)N)NNN)frPrrrWrrrrrrSr importlib.utilr threadingrZtlocal functoolsrr4rrrrr r__all__r8r5rjrrwrr,rr+rrr0rrr\rrrrrrrrrrrrrrrIrrrrrrr.rr-rr/r1r r!r"rrrr#r$r!r(r%r&r'r7r(r)r*rrrrr4r3rrrrrrr2rr6r7r r r r s    $  %      %          + f   & <