HOME


sh-3ll 1.0
DIR:/usr/local/lib64/python3.6/site-packages/numpy/distutils/__pycache__/
Upload File :
Current File : //usr/local/lib64/python3.6/site-packages/numpy/distutils/__pycache__/npy_pkg_config.cpython-36.pyc
3

���h�2�@s�ddlZddlZddlZddlmZddddddgZejd	�ZGd
d�de�Z	Gdd�de�Z
dd�Zd
d�ZGdd�d�Z
Gdd�d�Zdd�Zdd�Zdd�Zdd�ZdBdd�ZdCdd�ZiZdDdd�Zedk�r�ddlmZddlZe�Zejd d!d"d#d$�ejd%d&d"d'd$�ejd(d)d*d+�ejd,d-d"d.d$�ejd/d0d1d+�ejd2d3d"d1d$�ejd4d5d6d+�ejej�\ZZ e!e �d7k�r�e"d8��ej#�r�ejd9�Z$x.e$D]&Z%ee%�Z&e'd:e&j(e&j(e&j)f��q�We d;Z*ej+j,d<�Z-e-�r�ee*d=d>e-g�Z&nee*d=d>g�Z&ej.�rej.Z.nd?Z.ej/�rbej0d@ej/�Z1e1�sDe"dA��ne1j2d;�Z(e1j2d7�Z3e3e&j4e(<ej5�rxe'e&j5e.��ej6�r�e'e&j6e.��ej7�r�e'e&j7�ej8�r�e'e&j7ej8k�dS)E�N)�RawConfigParser�FormatError�PkgNotFound�LibraryInfo�VariableSet�read_config�parse_flagsz\$\{([a-zA-Z0-9_-]+)\}c@s eZdZdZdd�Zdd�ZdS)rzQ
    Exception thrown when there is a problem parsing a configuration file.

    cCs
||_dS)N)�msg)�selfr	�r�?/tmp/pip-build-5_djhm0z/numpy/numpy/distutils/npy_pkg_config.py�__init__szFormatError.__init__cCs|jS)N)r	)r
rrr�__str__szFormatError.__str__N)�__name__�
__module__�__qualname__�__doc__r
rrrrrrsc@s eZdZdZdd�Zdd�ZdS)rz3Exception raised when a package can not be located.cCs
||_dS)N)r	)r
r	rrrr
szPkgNotFound.__init__cCs|jS)N)r	)r
rrrrszPkgNotFound.__str__N)rrrrr
rrrrrrscCs�gggggd�}d|jd�}x�|D]�}d|}t|�dkr$|jd�rb|dj|dd	�j��q$|jd
�r�|dj|dd	�j��q$|jd�r�|d
j|dd	�j��q$|jd�r�|dj|dd	�j��q$|dj|�q$W|S)a�
    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'

    )�include_dirs�library_dirs�	libraries�macros�ignored� z -�-rz-Ir�Nz-Lrz-lrz-Drr)�split�len�
startswith�append�strip)�line�d�flags�flagrrrrs 





cCs|jdd�S)N�\z\\)�replace)�valrrr�_escape_backslashIsr'c@s>eZdZdZddd�Zdd�Zddd	�Zdd
d�Zdd
�ZdS)ra$
    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.

    NcCs4||_||_|r||_ng|_||_||_||_dS)N)�name�description�requires�version�	_sections�vars)r
r(r)r+�sectionsr-r*rrrr
gszLibraryInfo.__init__cCst|jj��S)z�
        Return the section headers of the config file.

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

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

        )�listr,�keys)r
rrrr.rszLibraryInfo.sections�defaultcCs|jj|j|d�}t|�S)N�cflags)r-�interpolater,r')r
�sectionr&rrrr2�szLibraryInfo.cflagscCs|jj|j|d�}t|�S)N�libs)r-r3r,r')r
r4r&rrrr5�szLibraryInfo.libscCsVd|jd|jg}|jr&|jd�n|jddj|j��|jd|j�dj|�S)NzName: %szDescription: %sz	Requires:zRequires: %s�,zVersion: %s�
)r(r)r*r�joinr+)r
�mrrrr�szLibraryInfo.__str__)N)r1)r1)	rrrrr
r.r2r5rrrrrrLs


c@sHeZdZdZdd�Zdd�Zdd�Zdd	�Zd
d�Zdd
�Z	dd�Z
dS)ra
    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.

    cCs0tdd�|j�D��|_i|_i|_|j�dS)NcSsg|]\}}||f�qSrr)�.0�k�vrrr�
<listcomp>�sz(VariableSet.__init__.<locals>.<listcomp>)�dict�items�	_raw_data�_re�_re_sub�_init_parse)r
r!rrrr
�szVariableSet.__init__cCs(x"|jj�D]\}}|j||�qWdS)N)r@r?�_init_parse_var)r
r;r<rrrrC�szVariableSet._init_parsecCs"tjd|�|j|<||j|<dS)Nz\$\{%s\})�re�compilerArB)r
r(�valuerrrrD�szVariableSet._init_parse_varcs6�fdd�}x$tj|�r0||�}||kr*P|}qW|S)Ncs0x*�jj�D]}�j|j�j||�}qW|S)N)rAr0�subrB)rGr;)r
rr�_interpolate�sz-VariableSet.interpolate.<locals>._interpolate)�_VAR�search)r
rGrIZnvaluer)r
rr3�szVariableSet.interpolatecCst|jj��S)z�
        Return the list of variable names.

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

        Returns
        -------
        names : list of str
            The names of all variables in the `VariableSet` instance.

        )r/r@r0)r
rrr�	variables�szVariableSet.variablescCs
|j|S)N)r@)r
r(rrr�__getitem__�szVariableSet.__getitem__cCs||j|<|j||�dS)N)r@rD)r
r(rGrrr�__setitem__�s
zVariableSet.__setitem__N)rrrrr
rCrDr3rLrMrNrrrrr�scCsV|jd�std��t|jd��}x dD]}||kr&td|��q&Wd|krRg|d<|S)	N�metazNo meta section found !r(r)r+z6Option %s (section [meta]) is mandatory, but not foundr*)r(r)r+)�has_sectionrr>r?)�configr!r;rrr�
parse_meta�s

rRcCs>|jd�std��i}x|jd�D]\}}|||<q"Wt|�S)NrLzNo variables section found !)rPrr?r)rQr!r(rGrrr�parse_variables�s
rScCsttfS)N)Zmeta_d�r)rQrrr�parse_sections�srUcCsd|S)Nz%s.inir)�pkg_namerrr�pkg_to_filename�srWcs|r�fdd�|D�}n�g}t�}|j|�}t|�dksJtdt|���t|�}i}|jd�r�x"|jd�D]\}}t|�||<qlWdd�|j	�D�}	i}
i}xT|	D]L}i}
|j
|d�r�|j|d�||<x|j|�D]\}}||
|<q�W|
|
|<q�W|||
|fS)Ncsg|]}tjj|���qSr)�os�pathr8)r:r!)�filenamerrr=�sz parse_config.<locals>.<listcomp>�zCould not find file(s) %srLcSsg|]}|dkr|�qS)rOrL)rOrLr)r:�srrrr=sr*)r�readrr�strrRrPr?r'r.�
has_option�get)rZ�dirs�	filenamesrQ�nrOr-r(rGZsecsr.r*r\r!r)rZr�parse_config�s.


rdcs���fdd���|�\}}}}d|krtd|krt|d}|tjkrTtd||df��tj|}ttjj|j��|d<t|d|d|d|t	|�d	�S)
Ncs�t|��\}}}}x�|j�D]x\}}�t|��\}}}	}
x$|j�D]\}}||krB|||<qBWx4|	|j�D]$\}
}|rl|||
d|7<qlWqW||||fS)Nz %s)rdr?rW)�frOr-r.�reqs�rnameZrvalueZnmetaZnvarsZ	nsectionsZnreqsr;r<ZonameZovalue)�_read_configrarrrhs z&_read_config_imp.<locals>._read_configZpkgdir�pkgnamez-You should import %s to get information on %sr(r)r+)r(r)r+r.r-)
�sys�modules�
ValueErrorr'rXrY�dirname�__file__rr)rbrarOr-r.rfri�modr)rhrar�_read_config_imps

rpcCs8yt|Stk
r2tt|�|�}|t|<|SXdS)a
    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)�_CACHE�KeyErrorrprW)rirar<rrrrFs'�__main__)�OptionParserz--cflagsr2�
store_truez*output all preprocessor and compiler flags)�dest�action�helpz--libsr5zoutput all linker flagsz
--use-sectionr4z/use this section instead of default for options)rvrxz	--versionr+zoutput versionz--atleast-version�min_versionzMinimal versionz
--list-all�list_allz--define-variable�define_variablez%Replace variable with the given valuerz(Expect package name on the command line:z*.iniz
%s	%s - %sr[ZNPY_PKG_CONFIG_PATHznumpy/core/lib/npy-pkg-config�.r1z([\S]+)=([\S]+)zH--define-variable option should be of the form --define-variable=foo=bar)N)N)N)9rjrErX�configparserr�__all__rFrJ�IOErrorrrrr'rrrRrSrUrWrdrprqrr�optparsert�glob�parser�
add_option�
parse_args�argv�options�argsrrlrz�filesre�info�printr(r)rV�environr`r!r4r{rKr9�grouprGr-r2r5r+ryrrrr�<module>s�
*HD
$
(
3