B <ÓFd4@ã)@sðddlmZmZmZddlZddlZddlZddlZddlZddl Z ddl Z ddl Z ddl Z ddl Z ddlmZddlmZyddlmZWn ek r¬ddlmZYnXeƒZgZdd„Ze  e¡yeWn ek ròddlmZYnXdd lm Z dd l!m"Z"dd l!m#Z#d d ddddddddddddddddddd d!d"d#d$d%d&d'd(d)d*d+d,d-d.d/d0d1d2d3d4g)Z$Gd5d6„d6e%ƒZ&d7d4„Z'd8d0„Z(d9d„Z)d:d;„Z*d˜dd*„Z,d™d?d„Z-d@d)„Z.dAdB„Z/dšdEd.„Z0d›dFdG„Z1dHd„Z2e2ƒre3ddIdJdKdLdMdNdOdPdQ Z4dœdSdT„Z5n ddUdT„Z5dVdW„Z6dXd„Z7dYd„Z8dZd„Z9d[d„Z:d\d„Z;d]d„Zdadb„Z?dcdd„Z@e AdeejB¡jCZDe AdfejB¡jCZEe AdgejB¡jCZFe AdhejB¡jCZGdidj„ZHdkd,„ZIdld„ZJdmd+„ZKdndo„ZLdpd-„ZMdqd/„ZNdrd„ZOdsd„ZPdtd „ZQdudv„ZRdwdx„ZSdydz„ZTd{d!„ZUd|d"„ZVd}d~„ZWdd€„ZXdd#„ZYd‚d$„ZZdƒd%„Z[džd„d…„Z\d†d&„Z]d‡d'„Z^dŸdˆd(„Z_Gd‰d „d e%ƒZ`ifdŠd„Zad‹d „ZbdŒd„Zcd dŽd3„Zdd¡dd2„Zedd‘„Zfd¢d’d„Zgd“d„Zhd”d„Zid•d„Zjd–d—„ZkdS)£é)ÚdivisionÚabsolute_importÚprint_functionN)ÚDistutilsError)Úget_build_architecture)Úlocalc Cs>tdk r:x0tD](}yt |¡Wqtk r4YqXqWdS)N)Ú_tmpdirsÚshutilZrmtreeÚOSError)Úd©r úL/opt/alt/python37/lib64/python3.7/site-packages/numpy/distutils/misc_util.pyÚclean_up_temporary_directorys  r)ÚSet)Ú get_exception)Ú basestring)Únpy_load_moduleÚ ConfigurationÚget_numpy_include_dirsÚdefault_config_dictÚ dict_appendÚ appendpathÚgenerate_config_pyÚget_cmdÚallpathÚ get_mathlibsÚterminal_has_colorsÚred_textÚ green_textÚ yellow_textÚ blue_textÚ cyan_textÚ cyg2win32Úmingw32Ú all_stringsÚ has_f_sourcesÚhas_cxx_sourcesÚfilter_sourcesÚget_dependenciesÚis_local_src_dirÚget_ext_source_filesÚget_script_filesÚget_lib_source_filesÚget_data_filesÚdot_joinÚ get_frameÚ minrelpathÚnjoinÚ is_sequenceÚ is_stringÚas_listÚgpathsÚ get_languageÚ quote_argsrÚget_infoÚ get_pkg_infoÚget_num_build_jobsc@seZdZdZdd„ZdS)Ú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||_||_||_dS)N)ÚnameÚ build_infoÚ target_dir)Úselfr<r=r>r r r Ú__init__PszInstallableLib.__init__N)Ú__name__Ú __module__Ú __qualname__Ú__doc__r@r r r r r;:sr;cCsddlm}ttj dd¡ƒ}|ƒ}|dkr0|St| d¡ddƒt| d¡ddƒt| d ¡ddƒf}td d „|Dƒƒrz|St d d „|DƒƒSdS) aG 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 checked and if that is unset it returns 1. Returns ------- out : int number of parallel jobs that can be run r)Úget_distributionZNPY_NUM_BUILD_JOBSéNÚbuildZparallelZ build_extZ build_clibcss|]}|dkVqdS)Nr )Ú.0Úxr r r ú nsz%get_num_build_jobs..css|]}|dk r|VqdS)Nr )rHrIr r r rJqs) Únumpy.distutils.corerEÚintÚosÚenvironÚgetÚgetattrÚget_command_objÚallÚmax)rEZenvjobsÚdistZcmdattrr r r r:Vs cCsJt|ƒ}x|D]6}| |¡rp|t|ƒd…  ¡}|rp|  |  d¡¡qpW|  ¡|S)z/Return the MATHLIB line from numpyconfig.h Nz_numpyconfig.hz1_numpyconfig.h not found in numpy include dirs %rz#define MATHLIBú,) rMr^r_rÚexistsrÚopenÚ startswithrXÚstripÚextendr]Úclose) r^Z config_fileÚdirsÚfnÚfidZmathlibsÚsÚlineÚvaluer r r rÊs(     cCsÔt|ƒs |Sd|kr|S| tj¡}x6|rZy| dd¡}Wntk rPPYnX||=q&Wd}x^|r¾y| d|¡}Wntk rŒPYnX||ddkr¨|d7}qb||=||d=d}qbW|sÈdStj |¡S)z$Resolve `..` and '.' from path. rfrFz..r`)r3r]rMrtÚindexÚ ValueErrorr_)r^ÚlrZÚjr r r r0æs0   cCs$g}x|D]}t|ƒrêd|ks*d|kr„t |¡}t t||ƒ¡}|rT| |¡qè|rd| |¡qè|rr| |¡td||fƒndt||ƒ}tj |¡r¦| |¡nBtj |¡r¾| |¡n|rÌ| |¡tj |¡sètd||fƒq t |ƒr| t |||ƒ¡q | |¡q Wdd„|DƒS)NÚ*ú?z#could not resolve pattern in %r: %rznon-existing path in %r: %rcSsg|] }t|ƒ‘qSr )r0)rHrwr r r ú &sz_fix_paths..) r3Úglobr1r}rsÚprintrMr^ryr2Ú _fix_paths)rvÚ local_pathÚinclude_non_existingZ new_pathsÚnrwZp2Zn2r r r rŽs8            rŽr`TcCst|ƒr|f}t|||ƒS)z:Apply glob to paths and prepend local_path if needed. )r3rŽ)rvrrr r r r5(scCsLttdƒs t ¡t_t tj¡tj||tj|d\}}t  |d¡}||fS)NÚtempdir)ÚsuffixÚprefixÚdirÚtextÚw) roÚ_tdataÚtempfileZmkdtempr’rrsZmkstemprMÚfdopen)r“r”r–rr<Zfor r r Úmake_temp_file/s     r›cCsÂtjdkrdtjkrdSttjdƒr¾tj ¡r¾yzddl}| ¡|  d¡dkr¦|  d¡dkr¦|  d¡dk rx|  d¡dk s¢|  d ¡dk r”|  d ¡dk s¢|  d ¡dk r¦d SWnt k r¼YnXdS) NÚcygwinZ USE_COLORrÚisattyZcolorsZpairsZsetfZsetbZsetafZsetabZscprF) rmÚplatformrMrNroÚstdoutrÚcursesZ setuptermZtigetnumZtigetstrÚ Exception)r r r r r<s" rFééééééé ) ZblackÚredÚgreenÚyellowÚblueZmagentaÚcyanZwhiteÚdefaultFcCs|g}|r| d¡|r8dt | ¡d¡}| t|ƒ¡|r^dt | ¡d¡}| t|ƒ¡|rtdd |¡|fS|SdS)NÚ1éré(r§z [%sm%sú;)rsÚ _colour_codesrOÚlowerÚstrr_)r‚ÚfgÚbgZboldÚseqZfgcodeZbgcoder r r Ú colour_textZs r¹cCs|S)Nr )r‚r¶r·r r r r¹iscCs t|dƒS)Nr®)r¹)r‚r r r Ú default_textlsrºcCs t|dƒS)Nr©)r¹)r‚r r r rnscCs t|dƒS)Nrª)r¹)r‚r r r rpscCs t|dƒS)Nr«)r¹)r‚r r r rrscCs t|dƒS)Nr­)r¹)r‚r r r r!tscCs t|dƒS)Nr¬)r¹)r‚r r r r vscCs8tjdkr4| d¡r4|ddtj |dd…¡}|S)Nrœz /cygdriveé ú:é )rmržr{rMr^Únormcase)r^r r r r"{s cCs:tjdkr6tj dd¡dkr dStj dd¡dkr6dSdS) z0Return true when using mingw32 environment. Úwin32ZOSTYPEr`ZmsysTZMSYSTEMZMINGW32F)rmržrMrNrOr r r r r#€s  cCs8tj d¡}|dkr0ttj|d|d…ƒ}nd}|S)zGReturn version of MSVC runtime library, as defined by __MSC_VER__ macrozMSC v.éÿÿÿÿr¦r»N)rmÚversionÚfindrL)Zmsc_posZmsc_verr r r Úmsvc_runtime_versionŠs  rÃcCs,tƒ}|r$|dkrd|Sd|SndSdS)zFReturn name of MSVC runtime library if Python was built with MSVC >= 7éŒzmsvcr%iz vcruntime%iN)Úmsvc_runtime_major)Zverr r r Úmsvc_runtime_library“s  rÆcCs dddddddœ tƒd¡}|S) zFReturn major version of MSVC runtime coded like get_build_msvc_versionéFéGéPéZédrÄ)iiixiÜi@ilN)rOrÃ)Úmajorr r r rÅžs rÅz.*[.](cpp|cxx|cc)\Zz.*[.](f90|f95|f77|for|ftn|f)\Zz.*[.](f90|f95)\Zz\s*module\s*(?P[\w_]+)cCsTt|ƒs gSg}t|dƒ}x,|D]$}t|ƒ}|r | d¡}| |¡q W| ¡|S)zRReturn a list of Fortran f90 module names that given source file defines. Úrr<)Ú f90_ext_matchrzÚf90_module_name_matchÚgrouprsr~)ÚsourcernÚfrƒÚmr<r r r Ú_get_f90_modules°s   rÔcCs t|tƒS)N)Ú isinstancer)r‚r r r r3ÁscCsx|D]}t|ƒsdSqWdS)z4Return True if all items in lst are string objects. FT)r3)ZlstÚitemr r r r$Äs cCs(t|ƒr dSy t|ƒWn dSdS)NFT)r3rX)r¸r r r r2Ës cCst|ƒod|kpd|kS)Nr‰rŠ)r3)r‚r r r Úis_glob_patternÔsr×cCst|ƒrt|ƒS|gSdS)N)r2rV)r¸r r r r4×scCs<d}x2|D]*}t|tƒr t|ƒr(d}Pq t|ƒr d}q W|S)z2Determine language value (c,f77,f90) from sources NÚf90Úf77)rÕrµrÎÚfortran_ext_match)ÚsourcesZlanguagerÑr r r r6Ýs  cCsx|D]}t|ƒrdSqWdS)z.Return True if sources contains Fortran files TF)rÚ)rÛrÑr r r r%ês cCsx|D]}t|ƒrdSqWdS)z*Return True if sources contains C++ files TF)Ú cxx_ext_match)rÛrÑr r r r&ñs cCstg}g}g}g}xV|D]N}t|ƒrFt|ƒ}|r:| |¡qd| |¡qt|ƒrZ| |¡q| |¡qW||||fS)ztReturn four lists of filenames containing C, C++, Fortran, and Fortran 90 module sources, respectively. )rÚrÔrsrÜ)rÛZ c_sourcesZ cxx_sourcesZ f_sourcesZfmodule_sourcesrÑrnr r r r'øs    cCs4g}x*|D]"}t tj |d¡¡}| |¡q W|S)Nz*.h)rŒrMr^r_r})Zdirectory_listÚheadersr Úheadr r r Ú _get_headerss  rßcCsHg}x>|D]6}tj |¡}|ddkr |d|kr | |d¡q W|S)Nrr`)rMr^r]rs)Zlist_of_sourcesZdirecsrÒ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: rUÚ )r_)Zcc_argsZextra_postargsZpp_optsZcmdliner r r Ú_commandline_dep_string s râcCs tt|ƒƒS)N)rßrà)rÛr r r r(,scCsˆt|ƒs dStj |¡}tj t ¡|g¡}|t|ƒd… tj¡}|r\|ds\|dd…}|rp|ddkrpdStj  |¡}tj  |¡S)z1Return true if directory is local directory. FNrrFrG) r3rMr^rbÚ commonprefixÚgetcwdrXr]rtr_Úisdir)Z directoryZabs_dirÚcZnew_dirr r r r)0s    c#s~ddddœ‰t d¡}xbtj|ddD]P\}}}‡fdd„|Dƒ}||dd…<x&|D]}| |¡sTtj ||¡VqTWq&WdS)NrF)ÚCVSz.svnrGz(?:[~#]|\.py[co]|\.o)$T)Útopdowncsg|]}|ˆkr|‘qSr r )rHr )Úpruned_directoriesr r r‹Csz(general_source_files..)ÚreÚcompilerMÚwalkÚsearchr^r_)Útop_pathÚprune_file_patÚdirpathÚdirnamesÚ filenamesÚprunedrÒr )rér Úgeneral_source_files?s     rôc #s dddg‰t d¡‰x°tj|ddD]ž\}}}‡fdd„|Dƒ}||d d …<xt|D]l}tj ||¡‰tˆ|ƒ}g}x@t ˆ¡D]2}tj ˆ|¡} tj | ¡r~ˆ  | ¡s~|  | ¡q~W||fVqRWq$W|‰tˆ|ƒ}‡‡fd d„t ˆ¡Dƒ}d d„|Dƒ}||fVd S) zJReturn a directory name relative to top_path and files contained. rçz.svnrGz(?:[~#]|\.py[co]|\.o)$T)rècsg|]}|ˆkr|‘qSr r )rHr )rér r r‹Psz4general_source_directories_files..Ncs$g|]}ˆ |¡stj ˆ|¡‘qSr )rírMr^r_)rHrÒ)Údpathrïr r r‹]scSsg|]}tj |¡r|‘qSr )rMr^Úisfile)rHrÒr r r r‹_s) rêrërMrìr^r_rdÚlistdirrörírs) rîrðrñròrór ÚrpathÚfilesrÒr€r )rõrïrér Ú general_source_directories_filesIs&      rúcCsrg}dd„|jDƒ}| |¡| t|ƒ¡x@|jD]6}t|ƒrT| tt|ƒƒ¡q4tj  |¡r4|  |¡q4W|S)NcSsg|]}t|ƒr|‘qSr )r3)rHÚ_mr r r r‹fsz(get_ext_source_files..) rÛr}r(Údependsr)rVrôrMr^rörs)ÚextròrÛr r r r r*cs   cCsdd„|Dƒ}|S)NcSsg|]}t|ƒr|‘qSr )r3)rHrûr r r r‹qsz$get_script_files..r )Úscriptsr r r r+pscCsŽg}|d dg¡}dd„|Dƒ}| |¡| t|ƒ¡|d dg¡}x>|D]6}t|ƒrp| tt|ƒƒ¡qPtj |¡rP|  |¡qPW|S)NrFrÛcSsg|]}t|ƒr|‘qSr )r3)rHrûr r r r‹wsz(get_lib_source_files..rü) rOr}r(r)rVrôrMr^rörs)ÚlibròrÛrür r r r r,ts   cCs”tj ¡}| dd¡}|dkr*| dd¡}|stj d¡sFtj d¡rLd}nDtj d¡r^d }n2tj d ¡rpd }n d |kr| 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. Z EXT_SUFFIXNZSOr`ZlinuxZ gnukfreebsdz.soÚdarwinz.dylibÚwinz.dllZSOABIrfrF)Ú distutilsZ sysconfigZget_config_varsrOrmržr{ru)Z is_python_extZconfvarsZso_extr r r Úget_shared_lib_extension‚s       rcCsŒt|ƒr|gS|d}g}xl|D]d}t|dƒr0q t|ƒrL| tt|ƒƒ¡q t|ƒrxtj |¡rl|  |¡q„t d|ƒq t t |ƒƒ‚q W|S)NrFÚ__call__zNot existing data file:) r3ror)r}rVrôrMr^rörsrÚ TypeErrorÚrepr)ÚdatarÛròr‚r r r r-±s     cGsd dd„|Dƒ¡S)NrfcSsg|] }|r|‘qSr r )rHr[r r r r‹Åszdot_join..)r_)rYr r r r.ÄscCsRyt |d¡Stk rLt ¡dj}xt|dƒD] }|j}q:W|SXdS)z:Return frame object from call stack with given level. rFr¢N)rmÚ _getframeÚAttributeErrorÚexc_infoÚtb_framerWÚf_back)ÚlevelrpÚ_r r r r/Çs c @s~eZdZddddddddd d g Zd d gZd dgZgZdadd„Zdd„Zdd„Z dd„Z dd„Z dd„Z dbdd„Z dcd d!„Zddd"d#„Zded%d&„Zd'd(„Zd)d*„Zd+d,„Zd-d.„Zd/d0„Zd1d2„Zd3d4„Zd5d6„Zd7d8„Zd9d:„Zd;d<„Zdfd=d>„Zdgd?d@„ZdAdB„ZdCdD„ZdEdF„Z dGdH„Z!dIdJ„Z"dKdL„Z#dMdN„Z$dOdP„Z%dQdR„Z&dSdT„Z'dhdUdV„Z(didXdY„Z)djdZd[„Z*dkd]d^„Z+d_d`„Z,dS)lrÚpackagesÚ ext_modulesÚ data_filesÚ include_dirsÚ librariesrÝrþÚ py_modulesÚinstalled_librariesÚ define_macrosÚ package_dirÚinstalled_pkg_configr<rÁNrFúsetup.pyc Ksžt||ƒ|_d|_t|ƒ}t||ƒ|_|dkr:|j}d|_|dkrJ|j}n tj t |j|ƒ¡rjt |j|ƒ}tj |pvd¡sˆt d|fƒ‚||_ ||_ tjj |j d¡Ž|_|jdd…|_|jdd…|_x0|jD]&} t | | g¡¡} t|| t| ƒƒqÒWx.|jD]$} t | | i¡¡} t|| | ƒqW|j|j} |jdd…|_xt| ¡D]h} | | krdqR|| } t|| | ƒt| tƒr’|j | ¡n&t| tƒr¬|j | ¡n |j | ¡qRWtj t |dƒ¡rì|j  |j¡||j!|j<tddddd|_"d} xht#dd ƒD]Z}y t|ƒ}Wnt k r6PYnXyt$d |j%|j&ƒ} PWnt'k rdYnXqWt| |j(ƒr”| j"d r”|j)f| j"Ž||_*dS) a˜Construct 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. Nr`rfz%r is not a directoryz __init__.pyF)Úignore_setup_xxx_pyÚassume_default_configurationÚdelegate_options_to_subpackagesÚquietrFr£r?r)+r.r<rÁr/rrrrMr^rår1r†rîÚ package_pathr_r]Úpath_in_packageÚ _list_keysÚ list_keysÚ _dict_keysÚ dict_keysÚcopyrOÚsetattrr4Ú _extra_keysÚ extra_keysÚkeysrÕrVrsÚdictryrrÚoptionsrWrgrhrirkÚ __class__Ú set_optionsÚ setup_name)r?Z package_nameÚ parent_namerîrÚ caller_levelr-ZattrsZ caller_framer‘ÚvÚ known_keysr[Zcaller_instancerZrÒr r r r@ßsv               zConfiguration.__init__cCsF| ¡i}|j|j|j}x"|D]}t||ƒ}|r$|||<q$W|S)zâ Return a dictionary compatible with the keyword arguments of distutils setup function. Examples -------- >>> setup(**config.todict()) #doctest: +SKIP )Ú_optimize_data_filesr!r#r'rP)r?r r1r‘r[r r r Útodict@s    zConfiguration.todictcCs|jdst|ƒdS)Nr)r*r)r?Úmessager r r ÚinfoSs zConfiguration.infocCstj d|f¡dS)Nz Warning: %s)rmÚstderrÚwrite)r?r4r r r ÚwarnWszConfiguration.warncKs<x6| ¡D]*\}}||jkr(||j|<q td|ƒ‚q WdS)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*Úkeyr„r r r r,Zs   zConfiguration.set_optionscCsddlm}|ƒS)z2Return the distutils distribution object for self.r)rE)rKrE)r?rEr r r rEks zConfiguration.get_distributionc Cs¨| d¡}t|jg|ƒ}dd„t |¡Dƒ}g}xp|D]h}tj t|dƒ¡sPq8d| tj¡krbq8d | tj¡t |ƒ d…¡} |j | ||dd} |  | ¡q8W|S)NrfcSsg|]}tj |¡r|‘qSr )rMr^rå)rHrûr r r r‹usz:Configuration._wildcard_get_subpackage..z __init__.pyrGrF)r.r/) r]r1rrŒrMr^rörtr_rXÚget_subpackager}) r?Úsubpackage_namer.r/r‡Úsubpackage_pathrÚ config_listr r‘rær r r Ú_wildcard_get_subpackageps    z&Configuration._wildcard_get_subpackagec s:tj dtj |¡¡ztj tj |¡¡d}tˆj||ƒ}t d  |  d¡¡|dƒ‰t ˆdƒs”ˆj dszˆ dˆ¡t||ˆj||dd }nht|g|  d¡dd …Ž} | f} ‡‡fd d „} ‡‡fd d„} tjddkrê| | ƒ} n| | ƒ} ˆj| Ž}|jt||ƒkr(ˆ dt||ƒ|jf¡Wdtjd=X|S)Nrrrf)z.pyÚUrFÚ configurationrzCAssuming default configuration (%s does not define configuration())rF)r/rÀcsˆjjjdkr|ˆjf}|S)NrF)rAÚ__code__Ú co_argcountrî)rY)r?Ú setup_moduler r Ú fix_args_py2›s zDConfiguration._get_configuration_from_setup_py..fix_args_py2csˆjjjdkr|ˆjf}|S)NrF)rArBrCrî)rY)r?rDr r Ú fix_args_py3Ÿs zDConfiguration._get_configuration_from_setup_py..fix_args_py3r£z*Subpackage %r configuration returned as %r)rmr^ÚinsertrMrjÚsplitextÚbasenamer.r<rr_r]ror*r8rrîÚ version_inforA) r?Úsetup_pyr<r=r.r/r-r‘ÚconfigZpnrYrErFr )r?rDr Ú _get_configuration_from_setup_pyƒs6     z.Configuration._get_configuration_from_setup_pycCs:|dkr$|dkrtdƒ‚tj |¡}| d¡}|dkrRd|krR|j|||ddS|dkrlt|jg|ƒ}n&t|g|dd…ƒ}| |g¡d}t||j ƒ}|j d sÂtj  |¡sÂt|d |ƒ}tj  |¡s|j d sô|  d tj  |¡|f¡t|||j||dd}n|j|||||dd}|r2|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 specifiedrfr‰rF)r/rÀrrz setup_%s.pyrzEAssuming default configuration (%s/{setup_%s,setup}.py was not found))r†rMr^rIr]r?r1rrvr-r*rör8rjrrîrM)r?r<r=r.r/r‡rKrLr r r r;¯sF         zConfiguration.get_subpackageFc Csœ|r d}n|j}|j|||dd}|s0| d¡xH|D]@}|}t|tƒrP| ¡}| d| d¡|jf¡|jf|Žq6W|  ¡}|dk r˜| 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¢)r.r/z0No configuration returned, assuming unavailable.z Appending %s configuration to %sr<zTdistutils distribution has been initialized, it may be too late to add a subpackage ) r<r;r8rÕrr3r5rOrrE) r?r<r=Z standaloner.r>rLr rTr r r Úadd_subpackageìs&   zConfiguration.add_subpackagecs~t|ƒr|\‰}nd‰t|ƒr6‡‡fdd„|DƒdSt|ƒsLtd|fƒ‚ˆdkr„tj |¡rvˆ tj |¡|f¡Sˆ ||f¡Sˆj|dd}t |ƒrt ˆƒràt ˆƒ  tj ¡}|  ¡ttt|ƒdƒƒ}|  ¡x|D]}||sà||=qàWxæ|D]Þ}tj |¡std|ƒqüt|ˆjƒ}|  tj ¡}|  ¡g} d }xX|D]P} t | ƒr„|t|ƒkrttd ˆ|fƒ‚|  ||¡n |  | ¡|d7}qHW||d…r¼ˆ d ||f¡|   ¡ˆ tj  | ¡|f¡qüWnx|D]}ˆ ˆ|f¡qæWdSˆ ¡} | dk r(| jdk r(| j} nˆj} xJ|D]B}x:tt|ƒƒD]*\} }tj ˆjˆ| ¡}|  ||f¡qFWq4WdS) a†Recursively 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|]}ˆ ˆ|f¡‘qSr )Ú add_data_dir)rHrw)r r?r r r‹Tsz.Configuration.add_data_dir..znot a string: %rF)rrFzNot a directory, skippingrzcannot fill pattern %r with %rz,mismatch of pattern_list=%s and path_list=%s)r2r3rrMr^ÚisabsrOrIrvr×rr]rtÚreverserVrWrXrårrdrr†rsr8r_rErrúr)r?Z data_pathrvÚ pattern_listZrlrZr^røÚ path_listÚ target_listr‚rTrZd1rÒZ target_pathr )r r?r rOsn8                 zConfiguration.add_data_dircCsfi}x@|jD]6\}}||kr&tƒ||<x|D]}|| |¡q,Wq Wdd„| ¡Dƒ|jdd…<dS)NcSsg|]\}}|t|ƒf‘qSr )rV)rHrwrùr r r r‹—sz6Configuration._optimize_data_files..)rÚsetÚaddr9)r?Z data_dictrwrùrÒr r r r2s  z"Configuration._optimize_data_filescGst|ƒdkr(x|D]}| |¡qWdSt|dƒrB|d\}}nd}t|ƒrT|}nPt|ƒr”t|ƒdkrr|d}q¤x|D]}| ||f¡qxWdSnttt|ƒƒƒ‚|dkrìt|dƒr¼d}ntj   |¡rÎd}n tj   |¡}| ||f¡dS|j |dd}t |ƒrÄt |ƒr²| tj¡}| ¡xœ|D]„}| tj¡}| ¡| ¡g} d} x:|D]2} t | ƒr||  || ¡| d7} n |  | ¡qVW|  ¡| tj | ¡|f¡q(Wn| ||f¡dS| ¡} | dk rê| jdk rê| j} n|j} |  tj  |j|¡|f¡dS)a»Add 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'). rFNrrr`F)r)rXÚadd_data_filesr2r3rrÚtyperorMr^rPrjrvr×r]rtrQÚpoprsr_rErr)r?rùrÒr ZfilepatrvrRr^rSrTrZr‚rTrr r r rW™sbX                 zConfiguration.add_data_filescCs>| ¡}|dk r.t|dƒs g|_|j |¡n |j |¡dS)zðAdd 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)rErorr})r?ÚmacrosrTr r r Úadd_define_macros2s  zConfiguration.add_define_macroscGsH| |¡}| ¡}|dk r8|jdkr*g|_|j |¡n |j |¡dS)zçAdd 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)rvrErr})r?rvrrTr r r Úadd_include_dirsBs  zConfiguration.add_include_dirscs¸g‰xt|D]l‰tˆƒr2‡‡fdd„ˆ ˆ¡Dƒq tˆttfƒrLtˆƒdkrXttˆƒƒ‚‡‡fdd„ˆ ˆd¡Dƒq Wˆ ¡}|dk r¨|j dkršg|_ |j   ˆ¡n ˆj   ˆ¡dS)aÃAdd 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|f¡‘qSr )rsr<)rHrw)rÝr?r r r‹gsz-Configuration.add_headers..r¢csg|]}ˆ ˆd|f¡‘qS)r)rs)rHrw)rÝr^r r r‹ksrFN) r3rvrÕÚtuplerVrXrrrErÝr})r?rùrTr )rÝr^r?r Ú add_headersRs  " zConfiguration.add_headerscOs| dd¡}t||j|dS)a«Apply 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)rOr5r)r?rvÚkwsrr r r rvts zConfiguration.pathscCs8x2| ¡D]&}||}|dkr | |¡}|||<q WdS)N)rÛrürZ library_dirsZ module_dirsZ extra_objects)r(rv)r?ÚkwÚkr0Znew_vr r r Ú_fix_paths_dictƒs  zConfiguration._fix_paths_dictcKsØt |¡}t|j|ƒ|d<||d<d|krb|d}|d=t|tƒrH|g}x|D]}t|f|ŽqNW| |¡| dg¡}g}g|d<xæ|D]Þ} t| tƒr¦| | d¡d| kr^|   dd¡\} } t j   t |j| ƒ¡} t j  | ¡r^|jd| dd } t| tƒr|  ¡} xTd d „|  dg¡DƒD]:} |   d d¡d }|| kr|  dd¡t|f| ŽPqWqŠ| | ¡qŠW||d|d<|j| dg¡|d<d dlm}|f|Ž}|j |¡| ¡}|dk rÔ| d|¡|S)a»Add 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. r<rÛÚ extra_inforrFú@Nr¢)r/cSsg|] }|d‘qS)rr )rHr‡r r r r‹Ûsz/Configuration.add_extension..Z__OF__rr)Ú ExtensionzTdistutils distribution has been initialized, it may be too late to add an extension )r$r.r<rÕr)rrbrOr]r]rMr^rbr1rrår;rr3rYrsrrKrerrEr8)r?r<rÛr`Zext_argsrcr5rZlibnamesZlibnameZlnameZlpathrær‡ZllnamererýrTr r r Ú add_extension‹sV0                zConfiguration.add_extensioncKs2| ||d|¡| ¡}|dk r.| 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_libraryrEr8)r?r<rÛr=rTr r r Ú add_libraryòs zConfiguration.add_librarycCsDt |¡}|}||d<d|kr&g|d<| |¡|j ||f¡dS)z\Common implementation for add_library and add_installed_library. Do not use directlyrÛrüN)r$rbrrs)r?r<rÛÚ install_dirr=r r r rgs  zConfiguration._add_librarycCs@|si}tj |j|¡}| ||||¡|j t|||ƒ¡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)rMr^r_rrgrrsr;)r?r<rÛrir=r r r Úadd_installed_library's ,z#Configuration.add_installed_librarycCsj|dkr i}tj |¡d}tj |j|¡}|j|jkrR|j|j |||f¡n|||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. Nr)rMr^rHr_rr<rrs)r?ÚtemplateriZ subst_dictrIr r r Úadd_npy_pkg_configZs<  z Configuration.add_npy_pkg_configcGsH| |¡}| ¡}|dk r8|jdkr*g|_|j |¡n |j |¡dS)zµAdd scripts to configuration. Add the sequence of files to the beginning of the scripts list. Scripts will be installed under the /bin/ directory. N)rvrErþr})r?rùrþrTr r r Ú add_scripts£s  zConfiguration.add_scriptsc Ks(x*|jD] }t||ƒ}| | |g¡¡qWx*|jD] }t||ƒ}| | |i¡¡q4W|j|j|j}x¸| ¡D]¬}||krÜt||dƒ}|rž|||kržqt| d|||| dd¡f¡t ||||ƒ|j  |¡qt||jkr|  d|t||ƒ||f¡qt||krqtt d|ƒ‚qtWdS)Nz"Inheriting attribute %r=%r from %rr<rŠz*Ignoring attempt to set %r (from %r to %r)zDon't know about key=%r) r!rPr}rOr#Úupdater'r(r8r%rsr5r†)r?r)r:r[r1r r r r³s,       zConfiguration.dict_appendcCszddlm}|j|j|j}d}|d|jd7}| ¡x0|D](}t||dƒ}|rB|d|||ƒf7}qBW|d7}|S)Nr)Úpformatz<----- zConfiguration of z: z%s = %s z----->)Zpprintror!r#r'r<ÚsortrP)r?ror1r‚rar[r r r Ú__str__Ìs   zConfiguration.__str__cCsJtdƒ}| ¡d|_d|_tj d¡}|rFtj d|g¡}|tjd<|S)zF Returns the numpy.distutils config command instance. rLrÚPATHrf) rÚensure_finalizedZ dump_sourceZnoisyrMrNrOÚpathsepr_)r?ÚcmdZold_pathr^r r r Úget_config_cmdÙs  zConfiguration.get_config_cmdcCstdƒ}| ¡|jS)zh Return a path to a temporary directory where temporary files should be placed. rG)rrsZ build_temp)r?rur r r Úget_build_temp_dirçsz 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). z/ subroutine simple end rÙ)Úlang)rvÚ try_compile)r?Úsimple_fortran_subroutineÚ config_cmdÚflagr r r Ú have_f77cðszConfiguration.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) z/ subroutine simple end rØ)rx)rvry)r?rzr{r|r r r Ú have_f90cszConfiguration.have_f90ccCsPt|ƒr$|\}}t||j|jdn(ddlm}|j |j¡|j |j¡dS)zEAppend libraries, include_dirs to extension or library item. )rrr)reN)r2rrrrKrer})r?ZextlibZlib_namer=rer r r Ú append_tos  zConfiguration.append_toc Cs.d}d}t ¡}y@t |pd¡tjdgdtjddd}|j}t d|  ¡¡}Wn YnXt |¡|r~t |  d¡ƒ}|St j dkr¤tj d d¡r¤t|d d ƒ}n t|d d ƒ}tj |¡r*t|ƒ}|  ¡} | ¡| dd …dkr t d| ¡}|r*t |  d¡ƒ}n t d| ¡}|r*t |  d¡ƒ}|S)z+Return path's SVN revision number. NrfZ svnversionT)ÚshellrŸr6Ú close_fdsz(?P\d+)Úrevisionr¿ZSVN_ASP_DOT_NET_HACKZ_svnÚentriesz.svnr¥z\d+)"zdir[\n\r]+(?P\d+))rMräÚchdirÚ subprocessÚPopenÚPIPErŸrêÚmatchÚreadrLrÐrmržrNrOr1r^rörzr~rí) r?r^r‚rÓÚcwdrwÚsoutrƒrÒZfstrr r r Ú_get_svn_revision$s>     zConfiguration._get_svn_revisionc Cs8d}d}t ¡}y@t |pd¡tjdgdtjddd}|j}t d|  ¡¡}Wn YnXt |¡|r~t |  d¡ƒ}|St |dd ƒ}t |dd ƒ}tj  |¡r4d} t|ƒ} |   ¡ ¡} |  ¡i} x`t|d ƒD]R} |  ¡dd …\}}|| krø|} y t |ƒ}Wntk rwÔYnX|| |<qÔW|  | ¡}|S) z1Return path's Mercurial revision number. Nrfzhg identify --numT)r€rŸr6rz(?P\d+)r‚z.hgÚbranchz branch.cacherÍr¢)rMrär„r…r†r‡rŸrêrˆr‰rLrÐr1r^rörzr|r~Úfiler]r†rO)r?r^r‚rÓrŠrwr‹Z branch_fnZbranch_cache_fnZbranch0rÒZ revision0Z branch_maprƒZbranch1Z revision1r r r Ú_get_hg_revisionIsF        zConfiguration._get_hg_revisionc Csšt|ddƒ}|dk r|S|dkr@d|j d¡ddddd g}n|g}|dkrjdd |j d¡dd g}n|g}xÖ|D]Î}t|j|ƒ}tj |¡rvd }tj tj  |¡¡d } t |j| ƒ} yt d  |  d¡¡||ƒ} Wn.t k rtƒ} | t| ƒ¡d} YnX| dkrqvx&|D]} t| | dƒ}|dk rPqW|dk rvPqvW|dk r\||_|S| |j¡}|dkr~| |j¡}|dk r–t|ƒ}||_|S)a¹Try 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. rÁNz__version__.pyrfrÀz _version.pyz version.pyz__svn_version__.pyz__hg_version__.pyÚ __version__Z_version)z.pyr@rFrr)rPr<r]r1rrMr^rörHrIr.rr_Ú ImportErrorrr8rµrÁrŒr)r?Z version_fileZversion_variablerÁrùZ version_varsrÒr€r5r<r‘Zversion_moduleÚmsgr[r‚r r r Ú get_versionts\                zConfiguration.get_versionTcsVtˆjdƒ‰ˆ ˆj¡‰tj ˆ¡s,ˆdkr0dS‡‡‡‡fdd„}ˆ d|ƒf¡dS)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. z__svn_version__.pyNcsptj ˆ¡sFtˆƒ}ˆ dˆ|f¡tˆdƒ}| d|¡| ¡ddl}ˆˆjf‡fdd„ }|  |¡ˆS)NzCreating %s (version=%r)r—z version = %r rcspˆrlyt |¡|d|ƒWntk r2YnXy"t |d¡|d|dƒWntk rjYnXdS)Nzremoved ræ)rMÚremover )rÒrw)Údeleter r Úrm_fileØs zSConfiguration.make_svn_version_py..generate_svn_version_py..rm_file) rMr^rörµr5rzr7r~ÚatexitÚregister)rÁrÒr—r–)r•r‚r?Útargetr r Úgenerate_svn_version_pyÏs   zBConfiguration.make_svn_version_py..generate_svn_version_pyr`)r1rrŒrMr^rörW)r?r•ršr )r•r‚r?r™r Úmake_svn_version_pyºs   z!Configuration.make_svn_version_pycsVtˆjdƒ‰ˆ ˆj¡‰tj ˆ¡s,ˆdkr0dS‡‡‡‡fdd„}ˆ d|ƒf¡dS)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. z__hg_version__.pyNcsptj ˆ¡sFtˆƒ}ˆ dˆ|f¡tˆdƒ}| d|¡| ¡ddl}ˆˆjf‡fdd„ }|  |¡ˆS)NzCreating %s (version=%r)r—z version = %r rcspˆrlyt |¡|d|ƒWntk r2YnXy"t |d¡|d|dƒWntk rjYnXdS)Nzremoved ræ)rMr”r )rÒrw)r•r r r–s zQConfiguration.make_hg_version_py..generate_hg_version_py..rm_file) rMr^rörµr5rzr7r~r—r˜)rÁrÒr—r–)r•r‚r?r™r r Úgenerate_hg_version_pyùs   z@Configuration.make_hg_version_py..generate_hg_version_pyr`)r1rrrMr^rörW)r?r•rœr )r•r‚r?r™r Úmake_hg_version_pyås   z Configuration.make_hg_version_pyÚ __config__cCs|j |j|tf¡dS)zÉGenerate package __config__.py file containing system_info information used during building the package. This file is installed to the package installation directory. N)rrsr<r)r?r<r r r Úmake_config_pyszConfiguration.make_config_pycGs6ddlm}m}i}x|D]}||f||ƒŽqW|S)z¥Get resources information. Return information (from system_info.get_info) for all of the names in the argument list in a single dictionary. rF)r8r)Ú system_infor8r)r?Únamesr8rZ info_dictr[r r r r8s  zConfiguration.get_info)NNNNrFr)rF)rF)NNrF)NF)N)N)NN)T)T)rž)-rArBrCr r"r&Únumpy_include_dirsr@r3r5r8r,rEr?rMr;rNrOr2rWr[r\r^rvrbrfrhrgrjrlrmrrqrvrwr}r~rrŒrr“r›rrŸr8r r r r rÕsj [  ) ; )y "g$ 3 I  %+ F + * cCsN||krFddl}|jj}|dkr4ddlm}|dƒ‚| |¡}|||<||S)Nr)ÚDistutilsInternalErrorz+setup distribution instance not initialized)Zdistutils.coreÚcoreZ_setup_distributionÚdistutils.errorsr£rQ)ZcmdnameÚ_cacherrTr£rur r r r's  cCs(tjdd…}|s$ddl}| ¡g}|S)Nr)rr¢ÚnumpyZ get_include)rr§r r r r3s  cCs(ddl}tj tj |j¡ddd¡}|S)z;Return the path where to find the npy-pkg-config directory.rNr¤rÿznpy-pkg-config)r§rMr^r_rjre)r§r r r r Úget_npy_pkg_dir<s r¨cCs0ddlm}|r| tƒ¡ntƒg}|||ƒ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_configr©rsr¨)Úpkgnamerr©r r r r9Ds  cCsjddlm}t||ƒ}|| ¡ƒ}x*|| ¡ƒ ¡D]\}}|| |¡q4W|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_flagsrZrZignored)rªr¬r9ZcflagsZlibsr9r})r«rr¬Zpkg_infor5rar0r r r r8js-    cCsDtjddkrddl}nddl}y |jdStk r>dSXdS)Nrr£TF)rmrJÚbuiltinsZ __builtin__Ú__NUMPY_SETUP__r )r­r®r r r Úis_bootstrapping¦s r¯cCs: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)Úwarningsr8rr3)r<r.rr±rær r r r¶s  cKsVxP| ¡D]D\}}||krF||}t|tƒr6|||<qN|| |¡q |||<q WdS)N)r9rÕrµr})r r_rar0Zovr r r rÄs  cCs,tjjdkr,| dtjj¡}| dtjj¡}d}tj |¡rtj |¡d}tj tj |¡¡d}tj |¡\}}tj ||g¡}tj |dt |ƒ…|t |ƒd…¡|ksÚtj |dt |ƒ…|t |ƒd…¡|krætj  |¡}|t |ƒd…}tj |¡r|dd…}n|}tj  t |||ƒ¡S)Nr\r`rrF) rMr^rtrurPÚ splitdriverbrãr_rXrjÚnormpathr1)r”r^ZdriveZ absprefixZ pathdriver Zsubpathr r r rÏs" ** cCs¢ddlm}ddlm}|tj |¡ƒt|dƒ}| dtj  t j d¡¡| d¡| d¡x(|j   ¡D]\}}| d||f¡qnW| d ¡| ¡|S) zÅGenerate config.py file containing system_info information used during building the package. Usage: config['py_modules'].append((packagename, '__config__',generate_config_py)) r)r )Úmkpathr—z# This file is generated by %s zH# It contains system_info results at the time of building this package. z__all__ = ["get_info","show"] z%s=%r a def get_info(name): g = globals() return g.get(name, g.get(name + "_info", {})) def show(): 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)) )Znumpy.distutils.system_infor Zdistutils.dir_utilr´rMr^rjrzr7rbrmÚargvZ saved_resultsr9r~)r™r r´rÒrarZr r r räs     cCs|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))Z compiler_typer†Z_MSVCCompiler__version)Zcompilerr r r Ú msvc_version s  r¶)N)N)r`T)r`r`T)NNF)NN)F)r)N)N)NNN)lZ __future__rrrrMrêrmr$rŒr—r™r…r rr¥rZdistutils.msvccompilerrZ threadingrZtlocalr‘Zdummy_threadingr˜rrr˜rUrkZsetsrZnumpy.distutils.compatrZ numpy.compatrrÚ__all__Úobjectr;r:r7rrdrrr1rr0rŽr5r›rr)r³r¹rºrrrr!r r"r#rÃrÆrÅrëÚIrˆrÜrÚrÎrÏrÔr3r$r2r×r4r6r%r&r'rßràrâr(r)rôrúr*r+r,rr-r.r/rrrr¨r9r8r¯rrrrr¶r r r r Úsì           %               / \   & <  %