Current File : //usr/lib64/python2.7/site-packages/numpy/distutils/npy_pkg_config.pyo
�
E�`Qc@s-ddlZejddkr8ddlmZmZnddlmZmZmZddlZddlZddlZdddd	d
dgZ	ej
d�Zdefd
��YZ
defd��YZd�Zd�Zdefd��YZd	efd��YZd�Zd�Zd�Zd�Zdd�Zdd�ZiZdd�Zedkr)ddlZddlmZddl Z e�Z!e!j"ddddd d!d"�e!j"d#dd$dd d!d%�e!j"d&dd'd!d(�e!j"d)dd*dd d!d+�e!j"d,dd-d!d.�e!j"d/dd0dd d!d.�e!j"d1dd2d!d3�e!j#ej$�\Z%Z&e'e&�d4kr�e(d5��ne%j)r�e j d6�Z*x8e*D]-Z+ee+�Z,d7e,j-e,j-e,j.fGHq�Wne&d8Z/ddlZej0j1d9�Z2e2r0ee/d:d;e2g�Z,nee/d:d;g�Z,e%j3rZe%j3Z3nd<Z3e%j4r�ej5d=e%j4�Z6e6s�e(d>��ne6j7d8�Z-e6j7d4�Z8e8e,j9e-<ne%j:r�e,j:e3�GHne%j;r�e,j;e3�GHne%j<r	e,j<GHne%j=r)e,j<e%j=kGHq)ndS(?i����Nii(tSafeConfigParsert
NoOptionError(tConfigParserRRtFormatErrortPkgNotFoundtLibraryInfotVariableSettread_configtparse_flagss\$\{([a-zA-Z0-9_-]+)\}cBs eZdZd�Zd�ZRS(sQ
    Exception thrown when there is a problem parsing a configuration file.

    cCs
||_dS(N(tmsg(tselfR	((sD/usr/lib64/python2.7/site-packages/numpy/distutils/npy_pkg_config.pyt__init__scCs|jS(N(R	(R
((sD/usr/lib64/python2.7/site-packages/numpy/distutils/npy_pkg_config.pyt__str__s(t__name__t
__module__t__doc__RR(((sD/usr/lib64/python2.7/site-packages/numpy/distutils/npy_pkg_config.pyRs	cBs eZdZd�Zd�ZRS(s3Exception raised when a package can not be located.cCs
||_dS(N(R	(R
R	((sD/usr/lib64/python2.7/site-packages/numpy/distutils/npy_pkg_config.pyRscCs|jS(N(R	(R
((sD/usr/lib64/python2.7/site-packages/numpy/distutils/npy_pkg_config.pyRs(R
RRRR(((sD/usr/lib64/python2.7/site-packages/numpy/distutils/npy_pkg_config.pyRs	cs|tj|��t�_igd6gd6gd6gd6gd6���fd�}�j�}x|rw||�}qbW�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	librariestmacrostignoredcs|jd�rYt|�dkr9�dj|d�q�j�}�dj|�n�|jd�r�t|�dkr��dj|d�q�j�}�dj|�n_|jd�r��dj|d�n8|jd�r�d	j|d�n�d
j|��j�S(Ns-IiRs-LRs-lRs-DRR(t
startswithtlentappendt	get_token(tt(tdtlexer(sD/usr/lib64/python2.7/site-packages/numpy/distutils/npy_pkg_config.pyt
next_token=s (tshlextTruetwhitespace_splitR(tlineRR((RRsD/usr/lib64/python2.7/site-packages/numpy/distutils/npy_pkg_config.pyR"s		cCs|jdd�S(Ns\s\\(treplace(tval((sD/usr/lib64/python2.7/site-packages/numpy/distutils/npy_pkg_config.pyt_escape_backslashXscBsDeZdZdd�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.

    cCsL||_||_|r$||_n	g|_||_||_||_dS(N(tnametdescriptiontrequirestversiont	_sectionstvars(R
R$R%R'tsectionsR)R&((sD/usr/lib64/python2.7/site-packages/numpy/distutils/npy_pkg_config.pyRvs					cCs
|jj�S(s�
        Return the section headers of the config file.

        Parameters
        ----------
        None

        Returns
        -------
        keys : list of str
            The list of section headers.

        (R(tkeys(R
((sD/usr/lib64/python2.7/site-packages/numpy/distutils/npy_pkg_config.pyR*�stdefaultcCs'|jj|j|d�}t|�S(Ntcflags(R)tinterpolateR(R#(R
tsectionR"((sD/usr/lib64/python2.7/site-packages/numpy/distutils/npy_pkg_config.pyR-�scCs'|jj|j|d�}t|�S(Ntlibs(R)R.R(R#(R
R/R"((sD/usr/lib64/python2.7/site-packages/numpy/distutils/npy_pkg_config.pyR0�scCs{d|jg}|jd|j�|jr=|jd�n|jddj|j��|jd|j�dj|�S(NsName: %ssDescription: %ss	Requires:sRequires: %st,sVersion: %ss
(R$RR%R&tjoinR'(R
tm((sD/usr/lib64/python2.7/site-packages/numpy/distutils/npy_pkg_config.pyR�s	N(	R
RRtNoneRR*R-R0R(((sD/usr/lib64/python2.7/site-packages/numpy/distutils/npy_pkg_config.pyR[s	cBsMeZdZd�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.

    cCsTtg|j�D]\}}||f^q�|_i|_i|_|j�dS(N(tdicttitemst	_raw_datat_ret_re_subt_init_parse(R
Rtktv((sD/usr/lib64/python2.7/site-packages/numpy/distutils/npy_pkg_config.pyR�s4		cCs4x-|jj�D]\}}|j||�qWdS(N(R7R6t_init_parse_var(R
R;R<((sD/usr/lib64/python2.7/site-packages/numpy/distutils/npy_pkg_config.pyR:�scCs+tjd|�|j|<||j|<dS(Ns\$\{%s\}(tretcompileR8R9(R
R$tvalue((sD/usr/lib64/python2.7/site-packages/numpy/distutils/npy_pkg_config.pyR=�scsK�fd�}x5tj|�rF||�}||kr=Pn|}qW|S(Ncs>x7�jj�D]&}�j|j�j||�}qW|S(N(R8R+tsubR9(R@R;(R
(sD/usr/lib64/python2.7/site-packages/numpy/distutils/npy_pkg_config.pyt_interpolate�s$(t_VARtsearch(R
R@RBtnvalue((R
sD/usr/lib64/python2.7/site-packages/numpy/distutils/npy_pkg_config.pyR.�s
cCs
|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.

        (R7R+(R
((sD/usr/lib64/python2.7/site-packages/numpy/distutils/npy_pkg_config.pyt	variables�scCs|j|S(N(R7(R
R$((sD/usr/lib64/python2.7/site-packages/numpy/distutils/npy_pkg_config.pyt__getitem__�scCs!||j|<|j||�dS(N(R7R=(R
R$R@((sD/usr/lib64/python2.7/site-packages/numpy/distutils/npy_pkg_config.pyt__setitem__�s
(
R
RRRR:R=R.RFRGRH(((sD/usr/lib64/python2.7/site-packages/numpy/distutils/npy_pkg_config.pyR�s						cCs�|jd�std��ni}x'|jd�D]\}}|||<q4Wx9dddgD](}|j|�s^td|��q^q^W|jd�s�g|d<n|S(NtmetasNo meta section found !R$R%R's6Option %s (section [meta]) is mandatory, but not foundR&(thas_sectionRR6thas_key(tconfigRR$R@R;((sD/usr/lib64/python2.7/site-packages/numpy/distutils/npy_pkg_config.pyt
parse_meta�s
cCsX|jd�std��ni}x'|jd�D]\}}|||<q4Wt|�S(NRFsNo variables section found !(RJRR6R(RLRR$R@((sD/usr/lib64/python2.7/site-packages/numpy/distutils/npy_pkg_config.pytparse_variables�scCs
ttfS(N(tmeta_dtr(RL((sD/usr/lib64/python2.7/site-packages/numpy/distutils/npy_pkg_config.pytparse_sectionsscCsd|S(Ns%s.ini((tpkg_name((sD/usr/lib64/python2.7/site-packages/numpy/distutils/npy_pkg_config.pytpkg_to_filenamescCs�|r1g|D]}tjj||�^q
}n	|g}tjd dkrYt�}n	t�}|j|�}t|�dks�t	dt
|���nt|�}i}|jd�r�x0|j
d�D]\}}	t|	�||<q�Wng|j�D]}
|
dkr�|
^q�}i}i}
xs|D]k}
i}|j|
d�re|j|
d�|
|
<nx'|j
|
�D]\}}	|	||<quW|||
<q.W||||
fS(	Nis3.1isCould not find file(s) %sRFRIR&(smetas	variables(tostpathR2tsysR'RRtreadRRtstrRMRJR6R#R*t
has_optiontget(tfilenametdirsRt	filenamesRLtnRIR)R$R@tstsecsR*R&((sD/usr/lib64/python2.7/site-packages/numpy/distutils/npy_pkg_config.pytparse_configs2+		+
c
s���fd���|�\}}}}|jd�r�|jd�r�|d}|tjkrtd||df��ntj|}ttjj|j��|d<nt	d|dd|dd|dd|d	t
|��S(
Ncs�t|��\}}}}x�|j�D]�\}}�t|��\}}}	}
x6|j�D](\}}|j|�s_|||<q_q_Wx?|	|j�D]-\}
}|r�|||
cd|7<q�q�Wq(W||||fS(Ns %s(RaR6RSRK(tfRIR)R*treqstrnametrvaluetnmetatnvarst	nsectionstnreqsR;R<tonametovalue(t_read_configR\(sD/usr/lib64/python2.7/site-packages/numpy/distutils/npy_pkg_config.pyRl4s#tpkgdirtpkgnames-You should import %s to get information on %sR$R%R'R*R)(RKRVtmodulest
ValueErrorR#RTRUtdirnamet__file__RR(R]R\RIR)R*RcRntmod((RlR\sD/usr/lib64/python2.7/site-packages/numpy/distutils/npy_pkg_config.pyt_read_config_imp3s

"cCsDy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)
    <class 'numpy.distutils.npy_pkg_config.LibraryInfo'>
    >>> print npymath_info
    Name: npymath
    Description: Portable, core math library implementing C99 standard
    Requires:
    Version: 0.1  #random

    N(t_CACHEtKeyErrorRtRS(RnR\R<((sD/usr/lib64/python2.7/site-packages/numpy/distutils/npy_pkg_config.pyR\s'

t__main__(tOptionParsers--cflagstdestR-tactiont
store_truethelps*output all preprocessor and compiler flagss--libsR0soutput all linker flagss
--use-sectionR/s/use this section instead of default for optionss	--versionR'soutput versions--atleast-versiontmin_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(>RVtversion_infoRRRtconfigparserR>RTRt__all__R?RCtIOErrorRRRR#tobjectRRRMRNRQRSR4RaRtRuRR
toptparseRxtglobtparsert
add_optiont
parse_argstargvtoptionstargsRRpR~tfilesRbtinfoR$R%RRtenvironRZRR/RRDR3tgroupR@R)R-R0R'R}(((sD/usr/lib64/python2.7/site-packages/numpy/distutils/npy_pkg_config.pyt<module>s�	6	ID				((3		
"