o 6aT @sHddlZddlZddlZddlZddlZddlZddlZddlZddlZddl Z ddl Z ddl Z ddl mZddlZddlmZeZgZddZeegdZGdddZd d Zd d Zd dZddZdddZddZdddZddZ ddZ!ddZ"ddd Z#dd!d"Z$d#d$Z%e%re&dd%d&d'd(d)d*d+d,d- Z'dd/d0Z(ndd1d0Z(d2d3Z)d4d5Z*d6d7Z+d8d9Z,d:d;Z-dd?Z/d@dAZ0dBdCZ1dDdEZ2dFdGZ3e4dHej5j6Z7e4dIej5j6Z8e4dJej5j6Z9e4dKej5j6Z:dLdMZ;dNdOZdTdUZ?dVdWZ@dXdYZAdZd[ZBd\d]ZCd^d_ZDd`daZEdbdcZFdddeZGdfdgZHdhdiZIdjdkZJdldmZKdndoZLdpdqZMdrdsZNddtduZOdvdwZPdxdyZQddzd{ZRGd|d}d}ZSifd~dZTddZUddZVdddZWdddZXddZYdddZZddZ[ddZ\ddZ]ddZ^ddZ_ddhZ`ddZaddZbdS)N)local)DistutilsErrorc Cs:tdurtD]}zt|WqtyYqwdSdSN)_tmpdirsshutilrmtreeOSError)dr ;/usr/lib/python3/dist-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_language quote_argsget_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__Es zInstallableLib.__init__N)__name__ __module__ __qualname____doc__r=r r r r r8/s r8cCsddlm}z ttd}Wn tyt}Ynwt|d}t tj d|}|}|dur4|St | dddt | dddt | d ddf}td d |DrY|Std d |DS) 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_distributionNPY_NUM_BUILD_JOBSNbuildparallel build_ext build_clibcss|]}|duVqdSrr .0xr r r jsz%get_num_build_jobs..css|] }|dur|VqdSrr rJr r r rMms)numpy.distutils.corerClenossched_getaffinityAttributeErrormultiprocessing cpu_countminintenvirongetgetattrget_command_objallmax)rCrTenvjobsdistcmdattrr r r r5Ks$    r5cCsFt|}tt|D]}||}d|vr |ddvr d|||<q |S)N rz"'z"%s")listrangerO)argsiar r r r1os r1cCs|d}tjj|S)zDConvert a /-separated pathname to one using the OS's path separator./)splitrPpathjoin)r9splittedr r r rys  rcCstjtj|}tjtj|}t|t|kr|S||kr$dS||dt|krN|t|tjfvsDJt||t|f|t|dd}|S)z$Return path relative to parent_path.N)rPrhrealpathabspathrOseprepr)rh parent_pathpdapathr r r rel_path~s,rtcCsztd|j|j}tjtj|}Wn1tyEtd|j|j}t|t j |}t |dr=tjtj|j }ntjd}Ynw|durOt ||}|pRdS)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_localsrPrhdirnamern NameError __import__sysmoduleshasattrrurt)framerq caller_filer caller_namemodr r r get_path_from_frames     rcGszg}|D]}t|r|t|qt|sJ||q|}|s%d}ntjj|}tjjdkr9|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. rkrf) r,appendr+r-rPrhriroreplacer*)rhpathspjoinedr r r r+s    r+c Cs|dur tj|d}n t}|D]}tj|d}tj|r$|}nqtd|ft|+}g}d}|D]}||rR|t|d }|rR| | dq7Wd|S1s^wY|S)z/Return the MATHLIB line from numpyconfig.h Nz_numpyconfig.hz1_numpyconfig.h not found in numpy include dirs %rz#define MATHLIB,) rPrhrirexistsropen startswithrOstripextendrg) rh config_filedirsfnfidmathlibsslinevaluer r r rs4    rcCst|s|Sd|vr |S|tj}|r+z|dd}Wn ty%Ynw||=|sd}|rZz|d|}Wn ty@Ynw||ddkrN|d7}n ||=||d=d}|s/|s^dStj|S)z$Resolve `..` and '.' from path. rvrlz..rk)r-rgrProindex ValueErrorri)rhlrdjr r r r*s8      r*cCstt|S)z}sorts output of python glob for https://bugs.python.org/issue30461 to allow extensions to have reproducible build results)sortedglob)fileglobr r r sorted_globsrcCsBt|s Jtt|g}t|rJt||D]}t|rd|vs(d|vrSt|}tt||}|r;||q|rC||q|rJ||td||fqt||}t j |rd||qt j |rp||n|rw||t j |std||fqt|r|t |||q||qdd|DS)N*?z#could not resolve pattern in %r: %rznon-existing path in %r: %rcSsg|]}t|qSr )r*rKrr r r %z_fix_paths..) r,rptyper-rr+rrprintrPrhr _fix_paths)r local_pathinclude_non_existing new_pathsnrp2n2r r r rsB           rrkTcCst|r|f}t|||S)z:Apply glob to paths and prepend local_path if needed. )r-r)rrrr r r r/'s r/cCsLttdstt_ttjtj||tj|d\}}t |d}||fS)Ntempdir)suffixprefixdirtextw) r_tdatatempfilemkdtemprrrmkstemprPfdopen)rrrrr9for r r make_temp_file.s    rcCstjdkr dtjvr dSttjdrgtjrgzEddl}|| ddkrT| ddkrW| ddur<| ddusQ| d durJ| d dusQ| d durZWd SWdSWdSWdSt yfYdSwdS) Ncygwin USE_COLORrisattycolorspairssetfsetbsetafsetabscprl) r}platformrPrWrstdoutrcurses setuptermtigetnumtigetstr Exception)rr r r r;s2    rrl ) blackredgreenyellowbluemagentacyanwhitedefaultFcCsxg}|r |d|rdt|d}|t||r/dt|d}|t||r:dd||fS|S)N1r(rz [%sm%s;)r _colour_codesrXlowerstrri)rfgbgboldseqfgcodebgcoder r r colour_textYs rcCs|Srr )rrrr r r rhscC t|dS)Nrrrr r r default_textk rcCr)Nrrrr r r rmrrcCr)Nrrrr r r rorrcCr)Nrrrr r r rqrrcCr)Nrrrr r r rsrrcCr)Nrrrr r r rurrcCs8tjdkr|dr|ddtj|dd}|S)Nrz /cygdrive : )r}rrrPrhnormcase)rhr r r rzs rcCs:tjdkrtjdddkrdStjdddkrdSdS) z0Return true when using mingw32 environment. win32OSTYPErkmsysTMSYSTEMMINGW32F)r}rrPrWrXr r r r rs rcCs:tjd}|dkrttj|d|d}|Sd}|S)zGReturn version of MSVC runtime library, as defined by __MSC_VER__ macrozMSC v.rrN)r}versionfindrV)msc_posmsc_verr r r msvc_runtime_versions rcCs&t}|r|dkr d|Sd|SdS)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 rs rz.*\.(cpp|cxx|cc)\Zz.*\.(f90|f95|f77|for|ftn|f)\Zz.*\.(f90|f95)\Zz\s*module\s*(?P[\w_]+)cCsjt|sgSg}t|d}|D]}t|}|r"|d}||qWd|S1s.wY|S)zRReturn a list of Fortran f90 module names that given source file defines. rr9N) f90_ext_matchrf90_module_name_matchgroupr)sourcer~frmr9r r r _get_f90_moduless    rcCs t|tSr) isinstancerrr r r r-rr-cCs|D] }t|s dSqdS)z4Return True if all items in lst are string objects. FTr-)lstitemr r r r rcCs0t|rdSzt|WdStyYdSw)NFT)r-rOrrr r r r,s  r,cCst|o d|vp d|vS)Nrrrrr r r is_glob_patternsrcCst|rt|S|gSr)r,rarr r r r.sr.cCs:d}|D]}t|trt|rd}|St|rd}q|S)z2Determine language value (c,f77,f90) from sources Nf90f77)rrr fortran_ext_match)sourceslanguager r r r r0s r0cC|D] }t|r dSqdS)z.Return True if sources contains Fortran files TF)rrr r r r rrrcCr)z*Return True if sources contains C++ files TF) cxx_ext_matchrr r r r rr cCspg}g}g}g}|D]'}t|r"t|}|r||q ||q t|r,||q ||q ||||fS)ztReturn four lists of filenames containing C, C++, Fortran, and Fortran 90 module sources, respectively. )rrrr)r c_sources cxx_sources f_sourcesfmodule_sourcesr r~r r r r!s     r!cCs.g}|D]}ttj|d}||q|S)Nz*.h)rrPrhrir)directory_listheadersr headr r r _get_headers s  r&cCsDg}|D]}tj|}|ddkr|d|vr||dq|S)Nrrk)rPrhrgr)list_of_sourcesdirecsr r r r r _get_directoriess r)cCs6d}|d|7}|d|7}|d|d7}|S)zb Return commandline representation used to determine if a file needs to be recompiled z commandline: r` ri)cc_argsextra_postargspp_optscmdliner r r _commandline_dep_strings r0cCs tt|Sr)r&r))rr r r r"*s r"cCst|sdStj|}tjt|g}|t|dtj}|r.|ds.|dd}|r8|ddkr8dStj |}tj |S)z1Return true if directory is local directory. FNrrlrF) r-rPrhrn commonprefixgetcwdrOrgroriisdir) directoryabs_dircnew_dirr r r r#.s     r#c#sxddddtd}tj|ddD]&\}}}fdd|D}||dd<|D]}||s8tj||Vq)qdS)NrlCVS.svnrF(?:[~#]|\.py[co]|\.o)$Ttopdowncg|]}|vr|qSr r rKr pruned_directoriesr r rAz(general_source_files..)recompilerPwalksearchrhri)top_pathprune_file_patdirpathdirnames filenamesprunedr r r@r general_source_files=s    rMc #sgdtdtj|ddD]K\}}}fdd|D}||dd<|D]4}tj||t|}g}tD]}tj|} tj| rU | sU| | q<||fVq'q|t|}fddtD}d d|D}||fVdS) zJReturn a directory name relative to top_path and files contained. r8r;Tr<cr>r r r?r@r r rNrBz4general_source_directories_files..Ncs$g|]}|stj|qSr )rFrPrhrirKr )dpathrHr r r[scSg|] }tj|r|qSr )rPrhisfilerNr r r r]) rCrDrPrErhrirtlistdirrQrFr) rGrIrJrKrLr rpathfilesr rr )rOrHrAr general_source_directories_filesGs,      rVcCsng}dd|jD}|||t||jD]}t|r)|tt|qtj |r4| |q|S)NcSg|]}t|r|qSr rrK_mr r r rdrBz(get_ext_source_files..) rrr"dependsr#rarMrPrhrQr)extrKrr r r r r$as    r$cCsdd|D}|S)NcSrWr rrXr r r rorBz$get_script_files..r )scriptsr r r r%nsr%cCsg}|ddg}dd|D}|||t||ddg}|D]}t|r7|tt|q'tj|rB| |q'|S)NrlrcSrWr rrXr r r rurBz(get_lib_source_files..rZ) rXrr"r#rarMrPrhrQr)librKrrZr r r r r&rs   r&cCstj}|dd}|dur|dd}|sKtjds#tjdr'd}|Stjdr1d }|Stjd r;d }|Sd |vrK|d |d dd}|S)a;Return 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. For Python 3.2 this is implemented on Linux, but not on OS X. EXT_SUFFIXNSOrklinux gnukfreebsdz.sodarwinz.dylibwinz.dllSOABIrvrl) distutils sysconfigget_config_varsrXr}rrr) is_python_extconfvarsso_extr r r get_shared_lib_extensions&       rkcCst|r|gS|d}g}|D]1}t|drqt|r%|tt|qt|r;tj|r5| |qt d|qt t ||S)Nrl__call__zNot existing data file:) r-rr#rrarMrPrhrQrr TypeErrorrp)datarrKrr r r r's     r'cGsddd|DS)NrvcSsg|]}|r|qSr r )rKrer r r rrzdot_join..r+)rcr r r r(sr(cCsNzt|dWSty&tdj}t|dD]}|j}q|YSw)z:Return frame object from call stack with given level. rlr)r} _getframerRexc_infotb_framerbf_back)levelr_r r r r)s r)c@seZdZgdZddgZddgZgZ      dXd d Zd d Zd dZ ddZ ddZ ddZ dYddZ dYddZ   dZddZ  d[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)d^dQdRZ*d_dTdUZ+dVdWZ,dS)`r ) packages ext_modules data_files include_dirs librariesr$r\ py_modulesinstalled_libraries define_macros package_dirinstalled_pkg_configr9rNrlsetup.pyc Ks|t|||_d|_t|}t|||_|dur|j}d|_|dur%|j}ntjt |j|r5t |j|}tj|p;dsDt d|f||_ ||_ tjj |jd|_|jdd|_|jdd|_|jD]} t|| g} t|| t| qh|jD]} t|| i} t|| | q|j|j} |jdd|_|D]/} | | vrq|| } t|| | t| tr|j| qt| tr|j| q|j| qtjt |dr|j |j||j!|j<tddddd|_"d} t#dd D])}zt|}Wn t y Ynwz t$d |j%|j&} Wn t'y"Yqwt| |j(r9| j"d r9|j)d i| 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. Nrkrvz%r is not a directory __init__.pyF)ignore_setup_xxx_pyassume_default_configurationdelegate_options_to_subpackagesquietrlrr<rr )+r(r9rr)rrrPrhr3r+rrG package_pathrirgpath_in_package _list_keys list_keys _dict_keys dict_keyscopyrXsetattrr. _extra_keys extra_keyskeysrrardictrrur}optionsrbrwrxryr{ __class__ set_options setup_name)r< package_name parent_namerGr caller_levelrattrs caller_framerv known_keysrecaller_instancerdr r r r r=s|              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_filesrrrrY)r<r rrrer r r todict>s  zConfiguration.todictcCs|jds t|dSdS)Nr)rrr<messager r r infoQs  zConfiguration.infocCstjd|fdS)Nz Warning: %s )r}stderrwriterr r r warnUszConfiguration.warncKs6|D]\}}||jvr||j|<qtd|dS)z Configure Configuration instance. The following options are available: - ignore_setup_xxx_py - assume_default_configuration - delegate_options_to_subpackages - quiet zUnknown option: N)itemsrr)r<rkeyrr r r rXs    zConfiguration.set_optionscCsddlm}|S)z2Return the distutils distribution object for self.rrB)rNrC)r<rCr r r rCis zConfiguration.get_distributionc Cs|d}t|jg|}ddt|D}g}|D]4}tjt|ds&qd|tjvr/qd|tjt | d} |j | ||dd} | | q|S)NrvcSrPr )rPrhr3rXr r r rsrRz:Configuration._wildcard_get_subpackage..rrFrlrr) rgr+rrrPrhrQrorirOget_subpackager) r<subpackage_namerrrsubpackage_pathr config_listr rr6r r r _wildcard_get_subpackagens   z&Configuration._wildcard_get_subpackagec Cs&tjdtj|ztjtj|d}t|j||}t d | d|}t |dsH|j ds;|d|t|||j||dd} n#t|g| ddd } | f} |jjjdkrf| |jf} |j| } | jt||kr|d t||| jfWtjd=| SWtjd=| Stjd=w) Nrrtrv configurationrzCAssuming default configuration (%s does not define configuration())rlrrz*Subpackage %r configuration returned as %r)r}rhinsertrPrzsplitextbasenamer(r9r7rirgrrrr rGr__code__ co_argcount) r<setup_pyrrrrrr setup_moduleconfigpnrcr r r _get_configuration_from_setup_pys>     z.Configuration._get_configuration_from_setup_pycCsL|dur|dur tdtj|}|d}|dur)d|vr)|j|||ddSd|vs6Jt|||f|durCt|jg|}nt|g|dd}| |gd}t||j }|j d sntj |snt|d |}tj |s|j d s| d tj||ft|||j||dd}n |j|||||dd}|r|gSgS) 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 specifiedrvrrlrrrrz setup_%s.pyrzEAssuming default configuration (%s/{setup_%s,setup}.py was not found))rrPrhrrgrrpr+rrrrrQrrzr rGr)r<rrrrrrrr r r rsT       zConfiguration.get_subpackageFc Cs|rd}n|j}|j|||dd}|s|d|D]/}|}t|tr'|}t|ts4Jtt|| d| d|jf|j di|q| }|dur[|d|dSdS) 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 Nrrz0No configuration returned, assuming unavailable.z Appending %s configuration to %sr9zTdistutils distribution has been initialized, it may be too late to add a subpackage r ) r9rrrr rrrprrrXrrC) r<rr standalonerrrr r^r r r add_subpackages0   zConfiguration.add_subpackagec st|r |\}ndt|rfdd|DdSt|s&td|fdurBtj|r;tj||fS||fSj|dd}t |rt rt  tj }| ttt|d}| |D] }||sw||=qn|D]|}tj|std|qzt|j}| tj }| g} d }|D]9} t | r|t|krtd |f| ||n| ||ksJt| |||||f| | |d7}q||drd ||f| tj | |fqzdS|D] }|fqdSt rJt} | dur%| jdur%| j} nj} |D]}tt|D]\} }tjj| }| ||fq2q*dS) 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 rGsz.Configuration.add_data_dir..znot a string: %rFrrlzNot a directory, skippingrzcannot fill pattern %r with %rz,mismatch of pattern_list=%s and path_list=%s)r,r-rmrPrhisabsrrrrrrgroreverserarbrOr3rrtrrrrprrirCrwrVr)r< data_pathr pattern_listrlrdrhrT path_list target_listrr^rwd1r  target_pathr rr r s|8        (   zConfiguration.add_data_dircCs^i}|jD]\}}||vrt||<|D] }|||qqdd|D|jdd<dS)NcSsg|] \}}|t|fqSr )ra)rKrrUr r r rrRz6Configuration._optimize_data_files..)rwsetaddr)r< data_dictrrUr r r r rs  z"Configuration._optimize_data_filescGst|dkr|D]}||qdSt|dksJt|dr'|d\}}nd}t|r0|}n%t|rMt|dkr?|d}n|D] }|||fqAdSttt||duryt|drad}ntj |rjd}ntj |}|||fdS|j |dd}t |rt |r|tj}||D]=}|tj}||g} d} |D]} t | r| || | d7} q| | q| |tj| |fqdS|||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'). rlNrrlrkFr)rOadd_data_filesr,r-rmrprrrPrhrrzrrrgrorpoprrirCrwr)r<rUr r filepatrrrhrrrdrr^rwr r r rsh X           zConfiguration.add_data_filescCs@|}|durt|dsg|_|j|dS|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. Nr|)rCrr|r)r<macrosr^r r r add_define_macros%s  zConfiguration.add_define_macroscGJ||}|}|dur|jdurg|_|j|dS|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)rrCrxr)r<rrxr^r r r add_include_dirs5  zConfiguration.add_include_dirscsg|D]6trfddDqtttfr%tdkr+ttfdddDq}|durS|j durKg|_ |j dSj 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)r$r<r r rZrRz-Configuration.add_headers..rcsg|] }d|fqSr)rr)r$rhr r r^srlN) r-rrtuplerarOrmrprCr$r)r<rUr^r )r$rhr<r add_headersEs   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)rXr/r)r<rkwsrr r r rgs zConfiguration.pathscCs4|D]}||}|dvr||}|||<qdS)N)rrZrx library_dirs module_dirs extra_objects)rr)r<kwkrnew_vr r r _fix_paths_dictvs  zConfiguration._fix_paths_dictcKst|}t|j||d<||d<d|vr<|d}|d=t|tr$|g}|D]}t|ts3Jt|t|fi|q&|||dg}g}g|d<|D]k} t| t r]|| dd| vr| dd\} } t j t|j| } t j | r|jd| dd } t| tr| } d d | dgDD]} | d dd }|| kr| ddt|fi| nqqO|| qO||d|d<|j|dg|d<d dlm}|di|}|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_inforyrl@NrrcSsg|]}|dqSrr )rKrr r r rrz/Configuration.add_extension..__OF__rr| ExtensionzTdistutils distribution has been initialized, it may be too late to add an extension r )rr(r9rrrprrrXrrgrPrhrnr+rr3rr rrrr|rNrrvrCr)r<r9rrext_argsrrrylibnameslibnamelnamelpathr6rllnamerr[r^r r r add_extension~s` 0          zConfiguration.add_extensioncKs6|||d||}|dur|d|dSdS)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_libraryrCr)r<r9rr:r^r r r add_librarys zConfiguration.add_librarycCs@t|}||d<d|vrg|d<|||j||fdS)z\Common implementation for add_library and add_installed_library. Do not use directlyrrZN)rrryrr<r9r install_dirr:r r r r s  zConfiguration._add_librarycCs@|si}tj|j|}||||||jt|||dS)aQ 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)rPrhrirrr{rr8rr r r add_installed_librarys ,z#Configuration.add_installed_librarycCs\|duri}tj|j|}|j|jvr"|j|j|||fdS|||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)rPrhrirr9r~r)r<templater subst_dictr r r add_npy_pkg_configLs_  z Configuration.add_npy_pkg_configcGr)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<rUr\r^r r r add_scriptsrzConfiguration.add_scriptsc Ks|jD]}t||}|||gq|jD]}t||}|||iq|j|j|j}|D]S}||vrit||d}|rJ|||krJq5|d||||ddft |||||j |q5||jvr~| d|t||||fq5||vrq5t d|dS)Nz"Inheriting attribute %r=%r from %rr9rz*Ignoring attempt to set %r (from %r to %r)zDon't know about key=%r) rrYrrXrupdaterrrrrrr)r<rrrerr r r rs0        zConfiguration.dict_appendcCsvddlm}|j|j|j}d}|d|jd7}||D]}t||d}|r4|d|||f7}q |d7}|S)Nr)pformatz<----- zConfiguration of z: z%s = %s z----->)pprintrrrrr9sortrY)r<rrrrrer r r __str__s  zConfiguration.__str__cCsJtd}|d|_d|_tjd}|r#tjd|g}|tjd<|S)zF Returns the numpy.distutils config command instance. rrPATHrv) rensure_finalized dump_sourcenoisyrPrWrXpathsepri)r<cmdold_pathrhr r r get_config_cmds  zConfiguration.get_config_cmdcCstd}||jS)zh Return a path to a temporary directory where temporary files should be placed. rF)rr build_temp)r<rr r r get_build_temp_dirsz Configuration.get_build_temp_dircCd}|}|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 rlangr try_compiler<simple_fortran_subroutine config_cmdflagr r r have_f77c zConfiguration.have_f77ccCr)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_f90cr zConfiguration.have_f90ccCsht|r|\}}t||j|jddSddlm}t||s$Jt||j|j|j|jdS)zEAppend libraries, include_dirs to extension or library item. )ryrxrrN) r,rryrxrNrrrpr)r<extliblib_namer:rr r r append_to*s zConfiguration.append_toc Csz tjdg|d}Wn tjtfyYnwtd|}|r&t|dStj dkr9t j ddr9t |dd }nt |d d }t j|rt| }|}Wdn1sXwY|dd d krvtd |}|rtt|dSdStd|}|rt|dSdS)z+Return path's SVN revision number. svnversioncwd(?P\d+)revisionrSVN_ASP_DOT_NET_HACKN_svnentriesr:rz\d+)"zdir[\n\r]+(?P\d+)) subprocess check_outputCalledProcessErrorrrCmatchrVr r}rrPrWrXr+rhrQrreadrF)r<rhoutputrrr fstrr r r _get_svn_revision8s0       zConfiguration._get_svn_revisionc Cs8z tjgd|d}Wn tjtfyYnwtd|}|r't|dSt|dd}t|dd}t j |rd}t |}| }Wdn1sPwYi} t |d 1}|D]&} | dd \} } | |krq| }zt| } Wn tyYq_w| | | <q_Wdn1swY| |SdS) z1Return path's Mercurial revision number. )hgidentifyz--numrrrz.hgbranchz branch.cacheNrr)rrrrrCrrVr r+rPrhrQrrrrgrrX) r<rhrr branch_fnbranch_cache_fnbranch0r  revision0 branch_maprbranch1 revision1r r r _get_hg_revisionUsB           zConfiguration._get_hg_revisionc Cst|dd}|dur |S|dur d|jdddddd g}n|g}|dur5dd |jddd g}n|g}|D]y}t|j|}tj|rd }tjtj |d } t |j| } z t d | d|} Wnt y} z|t| d} WYd} ~ nd} ~ ww| durq:|D]} t| | d}|durnqz| d}Wn tyYnw|durnq:|dur||_|S||j}|dur||j}|durt|}||_|S)aTry to get version string of a package. Return a version string of the current package or None if the version information could not be detected. Notes ----- This method scans files named __version__.py, _version.py, version.py, and __svn_version__.py for string variables version, __version__, and _version, until a version number is found. rNz__version__.pyrvrz _version.pyz version.py__svn_version__.py__hg_version__.py __version___version)z.pyUrlrrt)rYr9rgr+rrPrhrQrrr(r7ri ImportErrorrr get_versionsrRrr r+)r< version_fileversion_variablerrU version_varsr rrr9rversion_moduleererr r r get_version{sr        zConfiguration.get_versionTcVtjdjtjsdurdSfdd}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. r,Nctjs/t}d|ftd}|d|Wdn1s*wYjffdd }t|S)NCreating %s (version=%r)r version = %r cpr6z t||d|Wn tyYnwzt|d|d|dWdSty5YdSwdSNzremoved r6rPremoverr rdeleter r rm_file &zSConfiguration.make_svn_version_py..generate_svn_version_py..rm_file rPrhrQrrrratexitregisterrr rDrCrr<targetr r generate_svn_version_py   zBConfiguration.make_svn_version_py..generate_svn_version_pyrk)r+rr rPrhrQr)r<rCrLr rJr make_svn_version_pys  z!Configuration.make_svn_version_pycr9)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. r-Ncr:)Nr;rr<cr=r>r?rArBr r rD rEzQConfiguration.make_hg_version_py..generate_hg_version_py..rm_filerFrIrJr r generate_hg_version_pyrMz@Configuration.make_hg_version_py..generate_hg_version_pyrk)r+rr+rPrhrQr)r<rCrOr rJr 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)rzrr9r)r<r9r r r make_config_pyszConfiguration.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. rl)r3r) system_infor3r)r<namesr3r info_dictrer r r r3"s zConfiguration.get_info)NNNNrlr)rl)NNrl)NFrNN)T)rQ)-r>r?r@rrrnumpy_include_dirsr=rrrrrCrrrrrrrrrrrrrrrrrrrrrrr r rr r+r8rNrPrRr3r r r r r sr a  " > +y "g$  3k   & L ) ( r cCsN||vr#ddl}|jj}|durddlm}|d||}|||<||S)Nr)DistutilsInternalErrorz+setup distribution instance not initialized)distutils.corecore_setup_distributiondistutils.errorsrXrZ)cmdname_cacherer^rXrr r r r/s  rcCs(tjdd}|sddl}|g}|S)Nr)r rWnumpy get_include)rxr_r 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. NPY_PKG_CONFIG_PATHNr_rZr]znpy-pkg-config) rPrWrX importlibutil find_specrhrirzorigin)r specr r r get_npy_pkg_dirDs  rgcCs0ddlm}|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_configrhrrg)pkgnamerrhr r r r4Xs  r4cCsfddlm}t||}||}||D] \}}|||q|d|d<|d=|d=|S)a9 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_flagsrr|ignored)rirkr4cflagslibsrr)rjrrkpkg_inforrrr r r r3~s -   r3cCs*ddl}z|jWdStyYdSw)NrTF)builtins__NUMPY_SETUP__rR)rpr r r is_bootstrappings rrcCs: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) stacklevel)warningsrr r)r9rrrtr6r r r rs rcKsR|D]"\}}||vr"||}t|tr|||<q|||q|||<qdSr)rrrr)r rrrovr r r rs   rcCs(tjjdkr|dtjj}|dtjj}d}tj|rtj|d}tjtj|d}tj|\}}tj||g}tj|dt ||t |d|ksltj|dt ||t |d|krrtj |}|t |d}tj|r|dd}n|}tj t |||S)Nrfrkrrl) rPrhrorr splitdrivernr1rirOrznormpathr+)rrhdrive absprefix pathdriver subpathr r r rs$  **   rcCsddlm}ddlm}|tj|t|dD}|dtj t j d|d|d|t d|jD] \}}|d ||fq?|t d Wd |S1s`wY|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)rS)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): if sys.version_info >= (3, 8): os.add_dll_directory(extra_dll_dir) else: os.environ.setdefault('PATH', '') os.environ['PATH'] += os.pathsep + 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 ----- 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 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)numpy.distutils.system_inforSdistutils.dir_utilr|rPrhrzrrrr}argvtextwrapdedent saved_resultsr)rKrSr|r rrdr r r rs      ccrcCs|jdks td|j|jS)zdReturn version major and minor of compiler instance if it is MSVC, raise an exception otherwise.msvcz"Compiler instance is not msvc (%s)) compiler_typer_MSVCCompiler__version)compilerr r r msvc_versionc s rcCsddlm}|S)Nrr2)distutils.msvccompilerr2rr r r r2k 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)rKr r r r ry rBz&sanitize_cxx_flags..r )cxxflagsr r r r6u 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. )rbrcspec_from_file_locationmodule_from_specloader exec_module)modnamemodfilerffoor r r r7| s  r7r)rkT)rkrkT)NNFrV)Fr)NNN)crPrCr}rrrGrrrrSrimportlib.utilrb threadingrtlocalrer\rrrr rH__all__r8r5r1rrtrr+rr*rrr/rrrrrrrrrrrrrrrrrDIrrrr r rr-rr,rr.r0rr r!r&r)r0r"r#rMrVr$r%r&rkr'r(r)r rrrgr4r3rrrrrrrr2rr6r7r r r r s   $    %                /  f   &<  o