1 ˆÄà „ÂÁÀ'äa ´i=3ã@sldZddlZddlZddlmZddlmZddlmZddl m Z ddd œZ Gd d „d eƒZ dd d „Z dS)aêdistutils.command.config Implements the Distutils 'config' command, a (mostly) empty command class that exists mainly to be sub-classed by specific module distributions and applications. The idea is that while every "config" command is different, at least they're all named the same, and users always see "config" in the list of standard commands. Also, this is a good place to put common configure-like tasks: "try to compile this C code", or "figure out where this header file lives". éN)ÚCommand)ÚDistutilsExecError)Úcustomize_compiler)Úlogz.cz.cxx)Úczc++c@s¸eZdZdZgd¢Zdd„Zdd„Zdd„Zd d „Zd d „Z d d„Z dd„Z dd„Z dd„Z d(dd„Zd)dd„Zd*dd„Zd+dd„Zd,dd „Zd-d"d#„Zdddgfd$d%„Zd.d&d'„ZdS)/Úconfigzprepare to build) )z compiler=Nzspecify the compiler type)zcc=Nzspecify the compiler executable)z include-dirs=ÚIz.list of directories to search for header files)zdefine=ÚDzC preprocessor macros to define)zundef=ÚUz!C preprocessor macros to undefine)z libraries=Úlz!external C libraries to link with)z library-dirs=ÚLz.directories to search for external C libraries)ÚnoisyNz1show every action (compile, link, run, ...) taken)z dump-sourceNz=dump generated source files before attempting to compile themcCs4d|_d|_d|_d|_d|_d|_d|_g|_dS)Né)ÚcompilerZccÚ include_dirsÚ librariesÚ library_dirsr Ú dump_sourceÚ temp_files©Úself©rú0/usr/lib64/python3.9/distutils/command/config.pyÚinitialize_options3szconfig.initialize_optionscCs�|jdur|jjpg|_nt|jtƒr6|j tj¡|_|jdurHg|_nt|jtƒr^|jg|_|jdurpg|_nt|jtƒrŒ|j tj¡|_dS©N) rZ distributionÚ isinstanceÚstrÚsplitÚosÚpathseprrrrrrÚfinalize_optionsBs       zconfig.finalize_optionscCsdSrrrrrrÚrunRsz config.runcCszddlm}m}t|j|ƒsv||j|jdd�|_t|jƒ|jrN|j |j¡|j rb|j  |j ¡|j rv|j  |j ¡dS)z^Check that 'self.compiler' really is a CCompiler object; if not, make it one. r)Ú CCompilerÚ new_compilerr)rÚdry_runÚforceN) Údistutils.ccompilerr"r#rrr$rrZset_include_dirsrZ set_librariesrZset_library_dirs)rr"r#rrrÚ_check_compilerYs ÿ zconfig._check_compilercCs€dt|}t|dƒ�V}|r>|D]}| d|¡q | d¡| |¡|ddkr^| d¡Wdƒn1sr0Y|S)NZ _configtestÚwz#include <%s> Ú éÿÿÿÿ)ÚLANG_EXTÚopenÚwrite)rÚbodyÚheadersÚlangÚfilenameÚfileÚheaderrrrÚ_gen_temp_sourcefileks     (zconfig._gen_temp_sourcefilecCs<| |||¡}d}|j ||g¡|jj|||d�||fS)Nz _configtest.i©r)r4rÚextendrZ preprocess)rr.r/rr0ÚsrcÚoutrrrÚ _preprocessws zconfig._preprocesscCs\| |||¡}|jr"t|d|ƒ|j |g¡\}|j ||g¡|jj|g|d�||fS)Nzcompiling '%s':r5)r4rÚ dump_filerZobject_filenamesrr6Úcompile)rr.r/rr0r7ÚobjrrrÚ_compile~szconfig._compilec Csr| ||||¡\}}tj tj |¡¡d} |jj|g| |||d�|jjdur\| |jj} |j  | ¡||| fS)Nr)rrZ target_lang) r=rÚpathÚsplitextÚbasenamerZlink_executableZ exe_extensionrÚappend) rr.r/rrrr0r7r<ÚprogrrrÚ_link‡s