+
     h  c                   s`    ^ RI t ^ RIt^ RIt^RIHt R t] P                  ! 4       3R ltR tR# )i    N)PkgConfigErrorc                s"   VP                  4        Fz  w  r#W 9  d   W0V&   K  \        W,          \        4      '       g   \        RV: R24      h\        V\        4      '       g   \        RV: R24      hW,          P	                  V4       K|  	  V # )zMerge values from cffi config flags cfg2 to cf1

Example:
    merge_flags({"libraries": ["one"]}, {"libraries": ["two"]})
    {"libraries": ["one", "two"]}
zcfg1[z] should be a list of stringszcfg2[)Zitems
isinstanceZlistZ	TypeErrorZextend)Zcfg1Zcfg2ZkeyZvalues   &&  5/usr/lib64/python3.14/site-packages/cffi/pkgconfig.pymerge_flagsr      sq     jjl
?Idi..# OPPeT**# OPPIU# # K    c                s"   RR.pVP                  V4       VP                  V 4        \        P                  ! V\        P                  \        P                  R7      pTP                  4       w  rgTP                  ^ 8w  d,    TP                  T4      p\        TP                  4       4      h\        P                  R8  d)   \        T\        4      '       g    TP                  T4      p\         P"                  R
8w  d   R
T9   d   \        RT: RT : RT: 24      hT#   \         d,   p\        R\        T4      P                  4       : 24      hRp?ii ; i  \         d     Li ; i  \         d    \        RT: RT : RT: R	T: 24      hi ; i)z5Calls pkg-config and returns the output if found
    z
pkg-configz--print-errors)ZstdoutZstderrzcannot run pkg-config: Nzpkg-config Z z5 returned bytes that cannot be decoded with encoding z:
Z\z3 returned an unsupported backslash-escaped output:
)i   )Zappend
subprocessZPopenZPIPEZEnvironmentErrorr    ZstrZstripZcommunicateZ
returncodeZdecodeZ	ExceptionsysZversion_infor   ZUnicodeDecodeErrorosZaltsep)libnameZflagZencodingZaZpcZeZboutZberrs   &&&     r   callr	      s[    
'(AHHTNHHWNa

P !JD	}}	;;x(D TZZ\**
4
4(=(=	B;;x(D 
yyDTT\"GT3 4 	4 K/  NCFLLNLMMN  		 " 	B "&4"A B B	Bs5   5D E E' E(&EEE$#E$''Fc                s   aaaaa	a
 R oR oR oR oR o	R o
VVVVV	V
3R lp/ pV  F  pV! V4      p\        W$4       K  	  V# )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                     V P                  4        Uu. uF$  qP                  R 4      '       g   K  VR,          NK&  	  up# u upi )-Ii   NNsplitZ
startswithstringx   & r   get_include_dirsZ.flags_from_pkgconfig.<locals>.get_include_dirsK   1    %||~D~!d1C"~DDD
   A A c                 r
   )-Lr   r   r   r   r   get_library_dirsZ.flags_from_pkgconfig.<locals>.get_library_dirsN   r   r   c                 r
   )-lr   r   r   r   r   get_librariesZ+flags_from_pkgconfig.<locals>.get_librariesQ   r   r   c                 s    R  pV P                  4        Uu. uF#  q"P                  R4      '       g   K  V! V4      NK%  	  up# u upi )c                 s`    V R ,          p RV 9   d   \        V P                  R^4      4      # V R3# )r   Z=N)Ztupler   )r   s   &r   _macroZ8flags_from_pkgconfig.<locals>.get_macros.<locals>._macroV   s1    "AaxQWWS!_--4y r   -Dr   )r   r   r   s   &  r   
get_macrosZ(flags_from_pkgconfig.<locals>.get_macrosU   s6    	! $*<<>H>a\\$5G	q	>HHHs
   AAc                     V P                  4        Uu. uF6  qP                  R 4      '       d   K  VP                  R4      '       d   K4  VNK8  	  up# u upi )r   r   r   r   r   r   get_other_cflagsZ.flags_from_pkgconfig.<locals>.get_other_cflags^   H    !<<> E>ad1C12d1C > E 	E E   AA	Ac                 r   )r   r   r   r   r   r   get_other_libsZ,flags_from_pkgconfig.<locals>.get_other_libsb   r   r    c                 s   < \         P                  ! 4       p\        V R 4      p\        V R4      pRS! V4      RS! V4      RS! V4      RS! V4      RS! V4      RS	! V4      /# )z--cflagsz--libsZinclude_dirsZlibrary_dirsZ	librariesZdefine_macrosZextra_compile_argsZextra_link_args)r   getfilesystemencodingr	   )
r   ZfseZ
all_cflagsZall_libsr   r   r   r   r   r!   s
   &   r   kwargsZ$flags_from_pkgconfig.<locals>.kwargsg   sr    '')':.
*,Z8,X6x0Z
3 "2:">~h7 	r   )r   )Zlibsr#   Zretr   Z	lib_flagsr   r   r   r   r   r!   s   &    @@@@@@r   flags_from_pkgconfigr$   <   sZ    EEEIEE
  C7O	C#  Jr   )	r   r   r   Zerrorr    r   r"   r	   r$   ) r   r   <module>r%      s,      !& "%!:!:!< D=r   