a XC?hV�@sPddlZddlmZddlTddlmZddlmZdd�ZGdd �d e�Z dS) �N)�Command)�*)�customize_compiler)�logcCsddlm}|�dS)Nr��show_compilers)�distutils.ccompilerrr�r �A/opt/alt/python39/lib64/python3.9/distutils/command/build_clib.pyrs rc@sfeZdZdZgd�ZddgZdddefgZdd �Zd d �Z d d �Z dd�Z dd�Z dd�Z dd�ZdS)� 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=�czspecify the compiler typerrz help-compilerNzlist available compilerscCs:d|_d|_d|_d|_d|_d|_d|_d|_d|_dS)Nr) r � build_temp� libraries� include_dirs�define�undefrr�compiler��selfr r r �initialize_options4szbuild_clib.initialize_optionscCsh|�dddddd�|jj|_|jr0|�|j�|jdurH|jjpDg|_t|jt�rd|j�tj �|_dS)NZbuild)rr )rr)rr)rr)rr) Zset_undefined_optionsZ distributionr�check_library_listr� isinstance�str�split�os�pathseprr r r �finalize_optionsDs�    zbuild_clib.finalize_optionscCs�|js dSddlm}||j|j|jd�|_t|j�|jdurN|j�|j�|j durv|j D]\}}|j� ||�q^|j dur�|j D]}|j� |�q�|� |j�dS)Nr)� new_compiler)r�dry_runr)rrr#rr$rrrZset_include_dirsrZ define_macrorZundefine_macro�build_libraries)rr#�name�valueZmacror r r �run^s" �     zbuild_clib.runcCs�t|t�std��|D]z}t|t�s8t|�dkr8td��|\}}t|t�sRtd��d|vsntjdkr~tj|vr~td|d��t|t�std��qdS) Nz+'libraries' option must be a list of tuples�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 '%s': may not contain directory separatorsrzMsecond element of each tuple in 'libraries' must be a dictionary (build info)) r�list�DistutilsSetupError�tuple�lenrr �sep�dict)rr�libr&� build_infor r r rvs, �� �� �zbuild_clib.check_library_listcCs,|js dSg}|jD]\}}|�|�q|S)N)r�append)rZ lib_names�lib_namer2r r r �get_library_names�s  zbuild_clib.get_library_namescCsZ|�|j�g}|jD]>\}}|�d�}|dus>t|ttf�sJtd|��|�|�q|S)N�sources�fin 'libraries' option (library '%s'), 'sources' must be present and must be a list of source filenames)rr�getrr+r-r,�extend)r� filenamesr4r2r6r r r �get_source_files�s  �� zbuild_clib.get_source_filescCs�|D]�\}}|�d�}|dus,t|ttf�s8td|��t|�}t�d|�|�d�}|�d�}|jj||j |||j d�}|jj |||j |j d�qdS)Nr6r7zbuilding '%s' library�macrosr)� output_dirr<rr)r=r) r8rr+r-r,r�infor�compilerrZcreate_static_libr )rrr4r2r6r<rZobjectsr r r r%�s,  ��   � �zbuild_clib.build_libraries)�__name__� __module__� __qualname__Z descriptionZ user_optionsZboolean_optionsrZ help_optionsrr"r(rr5r;r%r r r r r s ��$ r ) r Zdistutils.corerZdistutils.errorsZdistutils.sysconfigrZ distutilsrrr r r r r �s