ok

Mini Shell

Direktori : /opt/alt/python38/lib64/python3.8/site-packages/cffi/__pycache__/
Upload File :
Current File : //opt/alt/python38/lib64/python3.8/site-packages/cffi/__pycache__/pkgconfig.cpython-38.pyc

U

ل=^�@sHddlZddlZddlZddlmZdd�Ze��fdd�Zdd	�ZdS)
�N�)�PkgConfigErrorcCsj|��D]\\}}||kr"|||<qt||t�s>td|f��t|t�sVtd|f��||�|�q|S)z�Merge values from cffi config flags cfg2 to cf1

    Example:
        merge_flags({"libraries": ["one"]}, {"libraries": ["two"]})
        {"libraries": ["one", "two"]}
    z$cfg1[%r] should be a list of stringsz$cfg2[%r] should be a list of strings)�items�
isinstance�list�	TypeError�extend)Zcfg1Zcfg2�key�value�r�
/pkgconfig.py�merge_flagss

r
c
Cs2ddg}|�|�|�|�ztj|tjtjd�}Wn8tk
rl}ztdt|���f��W5d}~XYnX|��\}}|j	dkr�z|�
|�}Wntk
r�YnXt|����tj
dk�rt|t��sz|�
|�}Wn*tk
�rtd||||f��YnXtjd	k�r.d	|k�r.td
|||f��|S)z5Calls pkg-config and returns the output if found
    z
pkg-configz--print-errors)�stdout�stderrzcannot run pkg-config: %sNr)�zKpkg-config %s %s returned bytes that cannot be decoded with encoding %r:
%r�\zEpkg-config %s %s returned an unsupported backslash-escaped output:
%r)�append�
subprocess�Popen�PIPE�EnvironmentErrorr�str�stripZcommunicate�
returncode�decode�	Exception�sys�version_infor�UnicodeDecodeError�os�altsep)�libname�flag�encoding�aZpc�eZboutZberrrrr�calls4

(

��r&csjdd��dd��dd��dd��d	d
��dd��������fd
d�}i}|D]}||�}t||�qN|S)a�Return compiler line flags for FFI.set_source based on pkg-config output

    Usage
        ...
        ffibuilder.set_source("_foo", pkgconfig = ["libfoo", "libbar >= 1.8.3"])

    If pkg-config is installed on build machine, then arguments include_dirs,
    library_dirs, libraries, define_macros, extra_compile_args and
    extra_link_args are extended with an output of pkg-config for libfoo and
    libbar.

    Raises PkgConfigError in case the pkg-config call fails.
    cSsdd�|��D�S)NcSs"g|]}|�d�r|dd��qS)�-I�N��
startswith��.0�xrrr�
<listcomp>Ls
zBflags_from_pkgconfig.<locals>.get_include_dirs.<locals>.<listcomp>��split��stringrrr�get_include_dirsKsz.flags_from_pkgconfig.<locals>.get_include_dirscSsdd�|��D�S)NcSs"g|]}|�d�r|dd��qS)�-Lr(Nr)r+rrrr.Os
zBflags_from_pkgconfig.<locals>.get_library_dirs.<locals>.<listcomp>r/r1rrr�get_library_dirsNsz.flags_from_pkgconfig.<locals>.get_library_dirscSsdd�|��D�S)NcSs"g|]}|�d�r|dd��qS)�-lr(Nr)r+rrrr.Rs
z?flags_from_pkgconfig.<locals>.get_libraries.<locals>.<listcomp>r/r1rrr�
get_librariesQsz+flags_from_pkgconfig.<locals>.get_librariescsdd���fdd�|��D�S)NcSs0|dd�}d|kr$t|�dd��S|dfSdS)Nr(�=r)�tupler0)r-rrr�_macroVsz8flags_from_pkgconfig.<locals>.get_macros.<locals>._macrocsg|]}|�d�r�|��qS)�-Dr)r+�r:rrr.\s
z<flags_from_pkgconfig.<locals>.get_macros.<locals>.<listcomp>r/r1rr<r�
get_macrosUsz(flags_from_pkgconfig.<locals>.get_macroscSsdd�|��D�S)NcSs$g|]}|�d�s|�d�s|�qS)r'r;r)r+rrrr._s

�zBflags_from_pkgconfig.<locals>.get_other_cflags.<locals>.<listcomp>r/r1rrr�get_other_cflags^sz.flags_from_pkgconfig.<locals>.get_other_cflagscSsdd�|��D�S)NcSs$g|]}|�d�s|�d�s|�qS)r4r6r)r+rrrr.cs

�z@flags_from_pkgconfig.<locals>.get_other_libs.<locals>.<listcomp>r/r1rrr�get_other_libsbsz,flags_from_pkgconfig.<locals>.get_other_libscsFt��}t|d�}t|d�}�|��|��|��|��|��|�d�S)Nz--cflagsz--libs)Zinclude_dirsZlibrary_dirsZ	librariesZ
define_macrosZextra_compile_argsZextra_link_args)r�getfilesystemencodingr&)r!ZfseZ
all_cflagsZall_libs�r3r7r5r=r>r?rr�kwargsgs

�z$flags_from_pkgconfig.<locals>.kwargs)r
)ZlibsrBZretr!Z	lib_flagsrrAr�flags_from_pkgconfig<s	rC)	rrr�errorrr
r@r&rCrrrr�<module>s"

Zerion Mini Shell 1.0