ó 2ÄÈ[c@`sPddlmZmZmZddlZddlZddlZejddkrlddlm Z m Z nddl m Z m Z ddddd d gZ ej d ƒZdefd „ƒYZdefd „ƒYZd„Zd„Zdefd„ƒYZdefd„ƒYZd„Zd„Zd„Zd„Zdd„Zdd„ZiZdd„Ze dkrLddlZddl!m"Z"ddl#Z#e"ƒZ$e$j%dddddd d!ƒe$j%d"dd#ddd d$ƒe$j%d%dd&d d'ƒe$j%d(dd)ddd d*ƒe$j%d+dd,d d-ƒe$j%d.dd/ddd d-ƒe$j%d0dd1d d2ƒe$j&ej'ƒ\Z(Z)e*e)ƒd3krže+d4ƒ‚ne(j,röe#j#d5ƒZ-x=e-D]2Z.ee.ƒZ/e0d6e/j1e/j1e/j2fƒq½Wne)d7Z3ddlZej4j5d8ƒZ6e6r?ee3d9d:e6gƒZ/nee3d9d:gƒZ/e(j7rie(j7Z7nd;Z7e(j8rÐej9d<e(j8ƒZ:e:s¢e+d=ƒ‚ne:j;d7ƒZ1e:j;d3ƒZ<e<e/j=e1rïe0e/j>e7ƒƒne(j?re0e/j?e7ƒƒne(j@r'e0e/j@ƒne(jArLe0e/j@e(jAkƒqLndS(>i(tdivisiontabsolute_importtprint_functionNi(tRawConfigParsert NoOptionErrort FormatErrort PkgNotFoundt LibraryInfot VariableSett read_configt parse_flagss\$\{([a-zA-Z0-9_-]+)\}cB`s eZdZd„Zd„ZRS(sQ Exception thrown when there is a problem parsing a configuration file. cC`s ||_dS(N(tmsg(tselfR ((s=/tmp/pip-build-fiC0ax/numpy/numpy/distutils/npy_pkg_config.pyt__init__scC`s|jS(N(R (R ((s=/tmp/pip-build-fiC0ax/numpy/numpy/distutils/npy_pkg_config.pyt__str__s(t__name__t __module__t__doc__R R(((s=/tmp/pip-build-fiC0ax/numpy/numpy/distutils/npy_pkg_config.pyRs cB`s eZdZd„Zd„ZRS(s3Exception raised when a package can not be located.cC`s ||_dS(N(R (R R ((s=/tmp/pip-build-fiC0ax/numpy/numpy/distutils/npy_pkg_config.pyR scC`s|jS(N(R (R ((s=/tmp/pip-build-fiC0ax/numpy/numpy/distutils/npy_pkg_config.pyR!s(RRRR R(((s=/tmp/pip-build-fiC0ax/numpy/numpy/distutils/npy_pkg_config.pyRs cC`s5igd6gd6gd6gd6gd6}d|jdƒ}xò|D]ê}d|}t|ƒd krC|jd ƒr’|dj|d jƒƒq-|jd ƒr¿|dj|d jƒƒq-|jd ƒrì|dj|d jƒƒq-|jdƒr|dj|d jƒƒq-|dj|ƒqCqCW|S(s¶ Parse a line from a config file containing compile flags. Parameters ---------- line : str A single line containing one or more compile flags. Returns ------- d : dict Dictionary of parsed flags, split into relevant categories. These categories are the keys of `d`: * 'include_dirs' * 'library_dirs' * 'libraries' * 'macros' * 'ignored' t include_dirst library_dirst librariestmacrostignoredt s -t-is-Iis-Ls-ls-D(tsplittlent startswithtappendtstrip(tlinetdtflagstflag((s=/tmp/pip-build-fiC0ax/numpy/numpy/distutils/npy_pkg_config.pyR $s   cC`s|jddƒS(Ns\s\\(treplace(tval((s=/tmp/pip-build-fiC0ax/numpy/numpy/distutils/npy_pkg_config.pyt_escape_backslashNscB`sDeZdZdd„Zd„Zdd„Zdd„Zd„ZRS(s$ Object containing build information about a library. Parameters ---------- name : str The library name. description : str Description of the library. version : str Version string. sections : dict The sections of the configuration file for the library. The keys are the section headers, the values the text under each header. vars : class instance A `VariableSet` instance, which contains ``(name, value)`` pairs for variables defined in the configuration file for the library. requires : sequence, optional The required libraries for the library to be installed. Notes ----- All input parameters (except "sections" which is a method) are available as attributes of the same name. cC`sL||_||_|r$||_n g|_||_||_||_dS(N(tnamet descriptiontrequirestversiont _sectionstvars(R R%R&R(tsectionsR*R'((s=/tmp/pip-build-fiC0ax/numpy/numpy/distutils/npy_pkg_config.pyR ls      cC`st|jjƒƒS(sÚ Return the section headers of the config file. Parameters ---------- None Returns ------- keys : list of str The list of section headers. (tlistR)tkeys(R ((s=/tmp/pip-build-fiC0ax/numpy/numpy/distutils/npy_pkg_config.pyR+wstdefaultcC`s'|jj|j|dƒ}t|ƒS(Ntcflags(R*t interpolateR)R$(R tsectionR#((s=/tmp/pip-build-fiC0ax/numpy/numpy/distutils/npy_pkg_config.pyR/‡scC`s'|jj|j|dƒ}t|ƒS(Ntlibs(R*R0R)R$(R R1R#((s=/tmp/pip-build-fiC0ax/numpy/numpy/distutils/npy_pkg_config.pyR2‹scC`sqd|jd|jg}|jr3|jdƒn|jddj|jƒƒ|jd|jƒdj|ƒS(NsName: %ssDescription: %ss Requires:s Requires: %st,s Version: %ss (R%R&R'RtjoinR((R tm((s=/tmp/pip-build-fiC0ax/numpy/numpy/distutils/npy_pkg_config.pyRs  N( RRRtNoneR R+R/R2R(((s=/tmp/pip-build-fiC0ax/numpy/numpy/distutils/npy_pkg_config.pyRQs    cB`sMeZdZd„Zd„Zd„Zd„Zd„Zd„Zd„Z RS(s Container object for the variables defined in a config file. `VariableSet` can be used as a plain dictionary, with the variable names as keys. Parameters ---------- d : dict Dict of items in the "variables" section of the configuration file. cC`sTtg|jƒD]\}}||f^qƒ|_i|_i|_|jƒdS(N(tdicttitemst _raw_datat_ret_re_subt _init_parse(R Rtktv((s=/tmp/pip-build-fiC0ax/numpy/numpy/distutils/npy_pkg_config.pyR ¦s4  cC`s4x-|jjƒD]\}}|j||ƒqWdS(N(R9R8t_init_parse_var(R R=R>((s=/tmp/pip-build-fiC0ax/numpy/numpy/distutils/npy_pkg_config.pyR<®scC`s+tjd|ƒ|j|<||j|x7ˆjjƒD]&}ˆj|jˆj||ƒ}qW|S(N(R:R-tsubR;(RBR=(R (s=/tmp/pip-build-fiC0ax/numpy/numpy/distutils/npy_pkg_config.pyt _interpolate¹s$(t_VARtsearch(R RBRDtnvalue((R s=/tmp/pip-build-fiC0ax/numpy/numpy/distutils/npy_pkg_config.pyR0¶s   cC`st|jjƒƒS(sì Return the list of variable names. Parameters ---------- None Returns ------- names : list of str The names of all variables in the `VariableSet` instance. (R,R9R-(R ((s=/tmp/pip-build-fiC0ax/numpy/numpy/distutils/npy_pkg_config.pyt variablesÅscC`s |j|S(N(R9(R R%((s=/tmp/pip-build-fiC0ax/numpy/numpy/distutils/npy_pkg_config.pyt __getitem__ÖscC`s!||j|<|j||ƒdS(N(R9R?(R R%RB((s=/tmp/pip-build-fiC0ax/numpy/numpy/distutils/npy_pkg_config.pyt __setitem__Ùs ( RRRR R<R?R0RHRIRJ(((s=/tmp/pip-build-fiC0ax/numpy/numpy/distutils/npy_pkg_config.pyR™s       cC`s¤|jdƒstdƒ‚ni}x'|jdƒD]\}}|||tonametovalue(t _read_configR\(s=/tmp/pip-build-fiC0ax/numpy/numpy/distutils/npy_pkg_config.pyRl%s #tpkgdirtpkgnames-You should import %s to get information on %sR%R&R(R+R*( tsystmodulest ValueErrorR$RURVtdirnamet__file__RR(R]R\RKR*R+RcRntmod((RlR\s=/tmp/pip-build-fiC0ax/numpy/numpy/distutils/npy_pkg_config.pyt_read_config_imp$s  "cC`sDy t|SWn1tk r?tt|ƒ|ƒ}|t|<|SXdS(s Return library info for a package from its configuration file. 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 directories - usually including the NumPy base directory - where to look for npy-pkg-config files. Returns ------- pkginfo : class instance The `LibraryInfo` instance containing the build information. Raises ------ PkgNotFound If the package is not found. See Also -------- misc_util.get_info, misc_util.get_pkg_info Examples -------- >>> npymath_info = np.distutils.npy_pkg_config.read_config('npymath') >>> type(npymath_info) >>> print(npymath_info) Name: npymath Description: Portable, core math library implementing C99 standard Requires: Version: 0.1 #random N(t_CACHEtKeyErrorRuRT(RnR\R>((s=/tmp/pip-build-fiC0ax/numpy/numpy/distutils/npy_pkg_config.pyR Ms '   t__main__(t OptionParsers--cflagstdestR/tactiont store_truethelps*output all preprocessor and compiler flagss--libsR2soutput all linker flagss --use-sectionR1s/use this section instead of default for optionss --versionR(soutput versions--atleast-versiont min_versionsMinimal versions --list-alltlist_alls--define-variabletdefine_variables%Replace variable with the given valueis(Expect package name on the command line:s*.inis %s %s - %sitNPY_PKG_CONFIG_PATHsnumpy/core/lib/npy-pkg-configt.R.s([\S]+)=([\S]+)sH--define-variable option should be of the form --define-variable=foo=bar(Bt __future__RRRRoR@RUt version_infot ConfigParserRRt configparsert__all__RAREtIOErrorRRR R$tobjectRRRNRORRRTR6RaRuRvR RtoptparseRytglobtparsert add_optiont parse_argstargvtoptionstargsRRqRtfilesRbtinfotprintR%R&RStenvironRZRR1R€RFR5tgroupRBR*R/R2R(R~(((s=/tmp/pip-build-fiC0ax/numpy/numpy/distutils/npy_pkg_config.pyts”       * HD    $ ( 3       '