
    n&pha                        S r SSKJr  SSKrSSKJr  SSKJr  SSKJ	r	  SSK
JrJr  SS	KJr  SS
KJr  SSKJr   " S S\5      rg)zdistutils.command.build_clib

Implements the Distutils 'build_clib' command, to build a C/C++ library
that is included in the module distribution and needed by an extension
module.    )annotationsN)Callable)log)ClassVar   )new_compilershow_compilers)Command)DistutilsSetupError)customize_compilerc                      \ rS rSr% Sr/ SQrS\S'   SS/rS\S	'   S
SS\4/r	S\S'   S r
SS jrSS jrSS jrS rS rSS jrSrg)
build_clib   z/build C/C++ libraries used by Python extensions))zbuild-clib=bz%directory to build C/C++ libraries to)zbuild-temp=tz,directory to put temporary build by-products)debuggz"compile with debugging information)forcefz2forcibly build everything (ignore file timestamps))z	compiler=czspecify the compiler typez$ClassVar[list[tuple[str, str, str]]]user_optionsr   r   zClassVar[list[str]]boolean_optionszhelp-compilerNzlist available compilerszAClassVar[list[tuple[str, str | None, str, Callable[[], object]]]]help_optionsc                    S U l         S U l        S U l        S U l        S U l        S U l        S U l        SU l        S U l        g )NF)	r   
build_temp	librariesinclude_dirsdefineundefr   r   compilerselfs    [/var/www/html/venv/lib/python3.13/site-packages/setuptools/_distutils/command/build_clib.pyinitialize_optionsbuild_clib.initialize_options-   sF      !


    c                   U R                  SSSSSS5        U R                  R                  U l        U R                  (       a  U R                  U R                  5        U R                  c$  U R                  R                  =(       d    / U l        [        U R                  [        5      (       a/  U R                  R                  [        R                  5      U l        g g )Nbuild)r   r   )r   r   )r    r    )r   r   )r   r   )
set_undefined_optionsdistributionr   check_library_listr   
isinstancestrsplitospathsepr!   s    r#   finalize_optionsbuild_clib.finalize_options<   s     	""(($	
 **44>>##DNN3$ $ 1 1 > > D"Dd''-- $ 1 1 7 7

 CD .r&   c                8   U R                   (       d  g [        U R                  U R                  U R                  S9U l        [        U R                  5        U R                  b%  U R                  R                  U R                  5        U R                  b0  U R                   H   u  pU R                  R                  X5        M"     U R                  b.  U R                   H  nU R                  R                  U5        M      U R                  U R                   5        g )N)r    dry_runr   )r   r   r    r4   r   r   r   set_include_dirsr   define_macror   undefine_macrobuild_libraries)r"   namevaluemacros       r#   runbuild_clib.runW   s    ~~$]]DLL


 	4==)(MM**4+<+<=;;"#{{**47  +::!,,U3 $ 	T^^,r&   c                   [        U[        5      (       d  [        S5      eU H  n[        U[        5      (       d  [	        U5      S:w  a  [        S5      eUu  p4[        U[
        5      (       d  [        S5      eSU;   d(  [        R                  S:w  a&  [        R                  U;   a  [        SUS    S35      e[        U[        5      (       a  M  [        S	5      e   g
)a0  Ensure that the list of libraries is valid.

`library` is presumably provided as a command option 'libraries'.
This method checks that it is a list of 2-tuples, where the tuples
are (library_name, build_info_dict).

Raise DistutilsSetupError if the structure is invalid anywhere;
just returns otherwise.
z+'libraries' option must be a list of tuplesr   z*each element of 'libraries' must a 2-tuplezNfirst element of each tuple in 'libraries' must be a string (the library name)/zbad library name 'r   z'': may not contain directory separatorszMsecond element of each tuple in 'libraries' must be a dictionary (build info)N)	r,   listr   tuplelenr-   r/   sepdict)r"   r   libr9   
build_infos        r#   r+   build_clib.check_library_listl   s     )T**%&STTCc5))c#h!m)*VWW"DdC((): 
 d{rvv}4)(Q0WX  j$//)8 % r&   c                z    U R                   (       d  g / nU R                    H  u  p#UR                  U5        M     U$ )N)r   append)r"   	lib_nameslib_name_build_infos       r#   get_library_namesbuild_clib.get_library_names   s8     ~~	%)^^!HX& &4r&   c                   U R                  U R                  5        / nU R                   HT  u  p#UR                  S5      nUb  [        U[        [
        45      (       d  [        SU S35      eUR                  U5        MV     U$ )Nsources in 'libraries' option (library 'D'), 'sources' must be present and must be a list of source filenames)r+   r   getr,   r@   rA   r   extend)r"   	filenamesrK   rF   rP   s        r#   get_source_filesbuild_clib.get_source_files   s    /	$(NN H nnY/Gj4-&H&H)6xj A1 1  W% %3 r&   c           	        U H  u  p#UR                  S5      nUb  [        U[        [        45      (       d  [	        SU S35      e[        U5      n[
        R                  " SU5        UR                  S5      nUR                  S5      nU R                  R                  UU R                  UUU R                  S9nU R                  R                  XrU R                  U R                  S9  M     g )	NrP   rQ   rR   zbuilding '%s' librarymacrosr   )
output_dirrY   r   r   )rZ   r   )rS   r,   r@   rA   r   r   infor    compiler   r   create_static_libr   )r"   r   rK   rF   rP   rY   r   objectss           r#   r8   build_clib.build_libraries   s    $- H nnY/Gj4-&H&H)6xj A1 1 
 7mGHH,h7
  ^^H-F%>>.9Lmm++??)jj , G MM++dooTZZ , 9 %.r&   )	r   r   r    r   r   r   r   r   r   )returnNone)__name__
__module____qualname____firstlineno__descriptionr   __annotations__r   r	   r   r$   r1   r<   r+   rM   rV   r8   __static_attributes__ r&   r#   r   r      sl    CK:L6  -4W+=O(= 
$ :NKWLS D6-*"H	r&   r   )__doc__
__future__r   r/   collections.abcr   distutils._logr   typingr   	ccompilerr   r	   corer
   errorsr   	sysconfigr   r   ri   r&   r#   <module>rs      s5    # 	 $   4  ( *m mr&   