HOME


Mini Shell 1.0
DIR: /snap/certbot/4482/lib64/python3.12/site-packages/cffi/__pycache__/
Upload File :
Current File : //snap/certbot/4482/lib64/python3.12/site-packages/cffi/__pycache__/pkgconfig.cpython-312.pyc
�

�S�g��\�ddlZddlZddlZddlmZd�Zej�fd�Zd�Zy)�N�)�PkgConfigErrorc���|j�D]d\}}||vr|||<�t||t�std|�d���t|t�std|�d���||j	|��f|S)z�Merge values from cffi config flags cfg2 to cf1

    Example:
        merge_flags({"libraries": ["one"]}, {"libraries": ["two"]})
        {"libraries": ["one", "two"]}
    zcfg1[z] should be a list of stringszcfg2[)�items�
isinstance�list�	TypeError�extend)�cfg1�cfg2�key�values    �~/build/snapcraft-certbot-29b1212f749eeba2f1dece1adfe9a83a/parts/certbot/install/lib/python3.12/site-packages/cffi/pkgconfig.py�merge_flagsrsz���j�j�l�$�
��U��d�?��D��I��d�3�i��.��#� O�P�P��e�T�*��#� O�P�P���I���U�#�$��K�c���ddg}|j|�|j|�	tj|tjtj��}|j�\}}|jdk7r+	|j|�}t|j���tjdk\r"t|t�s	|j|�}t j"dk7rd|vrtd|�d	|�d
|����|S#t$r*}tdt
|�j�����d}~wwxYw#t$rY��wxYw#t$rtd|�d	|�d
|�d|����wxYw)z5Calls pkg-config and returns the output if found
    z
pkg-configz--print-errors)�stdout�stderrzcannot run pkg-config: Nr)�zpkg-config � z5 returned bytes that cannot be decoded with encoding z:
�\z3 returned an unsupported backslash-escaped output:
)�append�
subprocess�Popen�PIPE�EnvironmentErrorr�str�strip�communicate�
returncode�decode�	Exception�sys�version_infor�UnicodeDecodeError�os�altsep)�libname�flag�encoding�a�pc�e�bout�berrs        r�callr0sZ��
�'�(�A��H�H�T�N��H�H�W��N�
�
�
�a�
���
���
P�����!�J�D�$�	�}�}���	��;�;�x�(�D��T�Z�Z�\�*�*�
���4��
�4��(=�	B��;�;�x�(�D�
�y�y�D��T�T�\��"�G�T�3�4�	4��K��/�N��C��F�L�L�N�L�M�M��N���	��	��"�	B� �"&���4�"A�B�
B�	B�s5�4D�?E�
E�	D>�%D9�9D>�	E
�E
�!E1c������	�
�d��d��d��d��d��	d��
�����	�
fd�}i}|D]}||�}t||��|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.
    c�r�|j�D�cgc]}|jd�s�|dd��c}Scc}w)N�-I���split�
startswith��string�xs  r�get_include_dirsz.flags_from_pkgconfig.<locals>.get_include_dirsK�-��%�|�|�~�D�!����d�1C��!�"��D�D��D��4�4c�r�|j�D�cgc]}|jd�s�|dd��c}Scc}w)N�-Lr4r5r8s  r�get_library_dirsz.flags_from_pkgconfig.<locals>.get_library_dirsNr<r=c�r�|j�D�cgc]}|jd�s�|dd��c}Scc}w)N�-lr4r5r8s  r�
get_librariesz+flags_from_pkgconfig.<locals>.get_librariesQr<r=c�~�d�}|j�D�cgc]}|jd�s�||���c}Scc}w)Nc�R�|dd}d|vrt|jdd��S|dfS)Nr4�=r)�tupler6)r:s r�_macroz8flags_from_pkgconfig.<locals>.get_macros.<locals>._macroVs3���!�"��A��a�x��Q�W�W�S�!�_�-�-��4�y� r�-Dr5)r9rHr:s   r�
get_macrosz(flags_from_pkgconfig.<locals>.get_macrosUs2��	!�$*�<�<�>�H�a�Q�\�\�$�5G��q�	�H�H��Hs�:�
:c��|j�D�cgc]'}|jd�r�|jd�s|��)c}Scc}w)Nr3rIr5r8s  r�get_other_cflagsz.flags_from_pkgconfig.<locals>.get_other_cflags^�B��!�<�<�>�E�a����d�1C�12���d�1C��E�	E��E�
�A�Ac��|j�D�cgc]'}|jd�r�|jd�s|��)c}Scc}w)Nr?rBr5r8s  r�get_other_libsz,flags_from_pkgconfig.<locals>.get_other_libsbrMrNc���tj�}t|d�}t|d�}�|��|��|��|��|��	|�d�S)Nz--cflagsz--libs)�include_dirs�library_dirs�	libraries�
define_macros�extra_compile_args�extra_link_args)r#�getfilesystemencodingr0)
r(�fse�
all_cflags�all_libsr;rCr@rJrLrPs
    ������r�kwargsz$flags_from_pkgconfig.<locals>.kwargsgsc����'�'�)���'�:�.�
����*��,�Z�8�,�X�6�&�x�0�'�
�3�"2�:�">�-�h�7�
�	r)r)�libsr\�retr(�	lib_flagsr;rCr@rJrLrPs     @@@@@@r�flags_from_pkgconfigr`<sa���E�E�E�I�E�E�
��
�C��$���7�O�	��C��#�$��Jr)	r#r&r�errorrrrXr0r`�rr�<module>rcs.����!��&";��!:�!:�!<��D=r