<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0-alpha1/dist/css/bootstrap.min.css" rel="stylesheet"
        integrity="sha384-GLhlTQ8iRABdZLl6O3oVMWSktQOp6b7In1Zl3/Jr59b6EGGoI1aFkw7cmDA6j6gD" crossorigin="anonymous">
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.3.0/css/all.min.css"
        integrity="sha512-SzlrxWUlpfuzQ+pcUCosxcglQRNAq/DZjVsC0lE40xsADsfeQoEypE+enwcOiGjk/bSuGGKHEyjSoQ1zVisanQ=="
        crossorigin="anonymous" referrerpolicy="no-referrer" />
</head>
</html>
U
    if=3                     @   sh   d dl 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	 dddZ
G d	d
 d
eZdddZdS )    N)Command)DistutilsExecError)customize_compiler)logz.cz.cxx)czc++c                	   @   s   e Zd ZdZdddddddd	d
g	Zdd Zdd Zdd Zdd Zdd Z	dd Z
dd Zdd Zdd Zd0dd Zd1d!d"Zd2d#d$Zd3d%d&Zd4d'd(Zd5d*d+Zdddg fd,d-Zd6d.d/ZdS )7configzprepare to build)z	compiler=Nzspecify the compiler type)zcc=Nzspecify the compiler executable)zinclude-dirs=Iz.list of directories to search for header files)zdefine=DzC preprocessor macros to define)zundef=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 themc                 C   s4   d | _ d | _d | _d | _d | _d| _d| _g | _d S )N   )compilerZccinclude_dirs	librarieslibrary_dirsr   dump_source
temp_filesself r   =/opt/alt/python38/lib64/python3.8/distutils/command/config.pyinitialize_options3   s    zconfig.initialize_optionsc                 C   s   | j d kr| jj pg | _ nt| j tr6| j tj| _ | jd krHg | _nt| jtr^| jg| _| jd krpg | _nt| jtr| jtj| _d S N)	r   Zdistribution
isinstancestrsplitospathsepr   r   r   r   r   r   finalize_optionsB   s    



zconfig.finalize_optionsc                 C   s   d S r   r   r   r   r   r   runR   s    z
config.runc                 C   sz   ddl m}m} t| j|sv|| j| jdd| _t| j | jrN| j| j | j	rb| j
| j	 | jrv| j| j d S )Nr   )	CCompilernew_compilerr   )r   dry_runZforce)distutils.ccompilerr"   r#   r   r   r$   r   r   Zset_include_dirsr   Zset_librariesr   Zset_library_dirs)r   r"   r#   r   r   r   _check_compilerY   s     
zconfig._check_compilerc              	   C   sl   dt |  }t|dL}|r>|D ]}|d|  q |d || |d dkr^|d W 5 Q R X |S )NZ_configtestwz#include <%s>

)LANG_EXTopenwrite)r   bodyheaderslangfilenamefileheaderr   r   r   _gen_temp_sourcefilek   s    

zconfig._gen_temp_sourcefilec                 C   s<   |  |||}d}| j||g | jj|||d ||fS )Nz_configtest.ir   )r3   r   extendr   Z
preprocess)r   r-   r.   r   r/   srcoutr   r   r   _preprocessw   s
    zconfig._preprocessc                 C   s\   |  |||}| jr"t|d|  | j|g\}| j||g | jj|g|d ||fS )Nzcompiling '%s':r4   )r3   r   	dump_filer   Zobject_filenamesr   r5   compile)r   r-   r.   r   r/   r6   objr   r   r   _compile~   s    zconfig._compilec           
      C   sr   |  ||||\}}tjtj|d }	| jj|g|	|||d | jjd k	r\|	| jj }	| j	|	 |||	fS )Nr   )r   r   Ztarget_lang)
r<   r   pathsplitextbasenamer   Zlink_executableZexe_extensionr   append)
r   r-   r.   r   r   r   r/   r6   r;   progr   r   r   _link   s    zconfig._linkc              	   G   sT   |s| j }g | _ tdd| |D ](}zt| W q& tk
rL   Y q&X q&d S )Nzremoving: %s )r   r   infojoinr   removeOSError)r   	filenamesr0   r   r   r   _clean   s    zconfig._cleanNr   c                 C   sR   ddl m} |   d}z| |||| W n |k
rD   d}Y nX |   |S )Nr   CompileErrorTF)r%   rK   r&   r8   rI   r   r-   r.   r   r/   rK   okr   r   r   try_cpp   s    
zconfig.try_cppc              	   C   sx   |    | ||||\}}t|tr0t|}t|.}d}	| }
|
dkrPqb||
r>d}	qbq>W 5 Q R X | 	  |	S )NF T)
r&   r8   r   r   rer:   r+   readlinesearchrI   )r   patternr-   r.   r   r/   r6   r7   r1   matchliner   r   r   
search_cpp   s    	



zconfig.search_cppc                 C   sd   ddl m} |   z| |||| d}W n |k
rD   d}Y nX t|rRdpTd |   |S )Nr   rJ   TFsuccess!failure.)r%   rK   r&   r<   r   rD   rI   rL   r   r   r   try_compile   s    
zconfig.try_compilec           
   	   C   sp   ddl m}m} |   z| |||||| d}	W n ||fk
rP   d}	Y nX t|	r^dp`d |   |	S Nr   )rK   	LinkErrorTFrW   rX   )r%   rK   r[   r&   rB   r   rD   rI   )
r   r-   r.   r   r   r   r/   rK   r[   rM   r   r   r   try_link   s    
  
zconfig.try_linkc              
   C   s   ddl m}m} |   z.| ||||||\}	}
}| |g d}W n ||tfk
rd   d}Y nX t|rrdptd | 	  |S rZ   )
r%   rK   r[   r&   rB   Zspawnr   r   rD   rI   )r   r-   r.   r   r   r   r/   rK   r[   r6   r;   ZexerM   r   r   r   try_run   s    
  

zconfig.try_runr   c           	      C   st   |    g }|r|d|  |d |r<|d|  n|d|  |d d|d }| |||||S )Nz
int %s ();zint main () {z  %s();z  %s;}r(   )r&   r@   rE   r\   )	r   funcr.   r   r   r   ZdeclZcallr-   r   r   r   
check_func  s    


 zconfig.check_funcc                 C   s    |    | d|||g| |S )Nzint main (void) { })r&   r\   )r   Zlibraryr   r.   r   Zother_librariesr   r   r   	check_lib4  s
    

 zconfig.check_libc                 C   s   | j d|g|dS )Nz/* No body */)r-   r.   r   )rN   )r   r2   r   r   r/   r   r   r   check_headerB  s    
zconfig.check_header)NNNr   )NNNr   )NNr   )NNNNr   )NNNNr   )NNNNr   r   )NNr   )__name__
__module____qualname__ZdescriptionZuser_optionsr   r    r!   r&   r3   r8   r<   rB   rI   rN   rV   rY   r\   r]   r`   ra   rb   r   r   r   r   r      s\   	
  

    
    
        
 
  r   c                 C   sJ   |d krt d|  n
t | t| }zt |  W 5 |  X d S )Nz%s)r   rD   r+   closeread)r0   headr1   r   r   r   r9   K  s    
r9   )N)r   rP   Zdistutils.corer   Zdistutils.errorsr   Zdistutils.sysconfigr   Z	distutilsr   r*   r   r9   r   r   r   r   <module>   s   
  8