
    ,ha                        d Z ddlmZ ddlZddlmZ ddlmZ ddlm	Z	 ddl
mZmZ dd	lmZ dd
lmZ ddlmZ  G d de      Zy)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                      e Zd ZU dZg dZded<   ddgZded<   d	d
defgZded<   d Z	ddZ
ddZddZd Zd ZddZy
)
build_clibz/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                    d | _         d | _        d | _        d | _        d | _        d | _        d | _        d| _        d | _        y )NF)	r   
build_temp	librariesinclude_dirsdefineundefr   r   compilerselfs    j/var/www/html/Resume-Scraper/venv/lib/python3.12/site-packages/setuptools/_distutils/command/build_clib.pyinitialize_optionszbuild_clib.initialize_options-   sF      !


    c                   | j                  dddddd       | j                  j                  | _        | j                  r| j                  | j                         | j                  | j                  j                  xs g | _        t        | j                  t              r/| j                  j                  t        j                        | _        y y )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_optionszbuild_clib.finalize_options<   s     	""(($	
 **44>>##DNN3$ $ 1 1 > > D"Dd''- $ 1 1 7 7

 CD .r$   c                *   | j                   sy t        | j                  | j                  | j                        | _        t        | j                         | j                  %| j                  j                  | j                         | j                  0| j                  D ]!  \  }}| j                  j                  ||       # | j                  ,| j                  D ]  }| j                  j                  |        | j                  | j                          y )N)r   dry_runr   )r   r   r   r1   r   r   r   set_include_dirsr   define_macror   undefine_macrobuild_libraries)r!   namevaluemacros       r"   runzbuild_clib.runW   s    ~~$]]DLL


 	4==)(MM**4+<+<=;;"#{{ 8e**478::! 4,,U34 	T^^,r$   c                   t        |t              st        d      |D ]  }t        |t              st	        |      dk7  rt        d      |\  }}t        |t
              st        d      d|v s%t        j                  dk7  r$t        j                  |v rt        d|d    d      t        |t              rt        d	       y
)a`  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   libr6   
build_infos        r"   r)   z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                n    | j                   sy g }| j                   D ]  \  }}|j                  |        |S )N)r   append)r!   	lib_nameslib_name_build_infos       r"   get_library_nameszbuild_clib.get_library_names   s?     ~~	%)^^ 	'!HkX&	'r$   c                    | j                  | j                         g }| j                  D ]N  \  }}|j                  d      }|t        |t        t
        f      st        d| d      |j                  |       P |S )Nsources in 'libraries' option (library 'D'), 'sources' must be present and must be a list of source filenames)r)   r   getr*   r<   r=   r   extend)r!   	filenamesrF   rB   rJ   s        r"   get_source_fileszbuild_clib.get_source_files   s    /	$(NN 		& Hj nnY/Gj4-&H)6xj A1 1  W%		& r$   c                   |D ]  \  }}|j                  d      }|t        |t        t        f      st	        d| d      t        |      }t        j                  d|       |j                  d      }|j                  d      }| j                  j                  || j                  ||| j                        }| j                  j                  ||| j                  | j                          y )	NrJ   rK   rL   zbuilding '%s' librarymacrosr   )
output_dirrR   r   r   )rS   r   )rM   r*   r<   r=   r   r   infor   compiler   r   create_static_libr   )r!   r   rF   rB   rJ   rR   r   objectss           r"   r5   zbuild_clib.build_libraries   s    $- 	 Hj nnY/Gj4-&H)6xj A1 1 
 7mGHH,h7
  ^^H-F%>>.9Lmm++??)jj , G MM++dooTZZ , 9	r$   )returnNone)__name__
__module____qualname__descriptionr   __annotations__r   r	   r   r#   r/   r9   r)   rH   rP   r5    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   r_   r$   r"   <module>ri      s5    # 	 $   4  ( *m mr$   