<!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>
3
2a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@dAdBdCdDdEdFg	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dGd-d.ZdHd/d0ZdId1d2ZdJd3d4ZdKd5d6ZdLd8d9Zdddg fd:d;ZdMd<d=ZdS )Nconfigzprepare to build	compiler=Nspecify the compiler typecc=specify the compiler executableinclude-dirs=I.list of directories to search for header filesdefine=DC preprocessor macros to defineundef=U!C preprocessor macros to undefine
libraries=l!external C libraries to link withlibrary-dirs=L.directories to search for external C librariesnoisy1show every action (compile, link, run, ...) takendump-source=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/python36/lib64/python3.6/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 jtj| _ | jd krHg | _nt| jtr^| jg| _| jd krpg | _nt| jtr| j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 )Nr'   )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 | j	rb| jj
| j	 | jrv| jj| j d S )Nr   )	CCompilernew_compilerr   )r    dry_runforce)distutils.ccompilerr1   r2   r*   r    r3   r   r!   Zset_include_dirsr"   Zset_librariesr#   Zset_library_dirs)r&   r1   r2   r'   r'   r(   _check_compilerY   s    
zconfig._check_compilerc             C   sl   dt |  }t|d}|r@x|D ]}|jd|  q W |jd |j| |d dkr`|jd |j  |S )NZ_configtestwz#include <%s>

r   )LANG_EXTopenwriteclose)r&   bodyheaderslangfilenamefileheaderr'   r'   r(   _gen_temp_sourcefilek   s    




zconfig._gen_temp_sourcefilec             C   s<   | j |||}d}| jj||g | jj|||d ||fS )Nz_configtest.i)r!   )rD   r%   extendr    Z
preprocess)r&   r>   r?   r!   r@   srcoutr'   r'   r(   _preprocessx   s
    zconfig._preprocessc             C   s\   | j |||}| jr"t|d|  | jj|g\}| jj||g | jj|g|d ||fS )Nzcompiling '%s':)r!   )rD   r$   	dump_filer    Zobject_filenamesr%   rE   compile)r&   r>   r?   r!   r@   rF   objr'   r'   r(   _compile   s    zconfig._compilec       
      C   sr   | j ||||\}}tjjtjj|d }	| jj|g|	|||d | jjd k	r\|	| jj }	| jj	|	 |||	fS )Nr   )r"   r#   Ztarget_lang)
rL   r-   pathsplitextbasenamer    Zlink_executableZexe_extensionr%   append)
r&   r>   r?   r!   r"   r#   r@   rF   rK   progr'   r'   r(   _link   s    zconfig._linkc             G   sX   |s| j }g | _ tjddj| x0|D ](}ytj| W q( tk
rN   Y q(X q(W d S )Nzremoving: %s )r%   r   infojoinr-   removeOSError)r&   	filenamesrA   r'   r'   r(   _clean   s    
zconfig._cleanr   c             C   sR   ddl m} | j  d}y| j|||| W n |k
rD   d}Y nX | j  |S )Nr   )CompileErrorTF)r5   rZ   r6   rH   rY   )r&   r>   r?   r!   r@   rZ   okr'   r'   r(   try_cpp   s    
zconfig.try_cppc             C   sx   | j   | j||||\}}t|tr0tj|}t|}d}	x&|j }
|
dkrPP |j|
r>d}	P q>W |j	  | j
  |	S )NF T)r6   rH   r*   r+   rerJ   r;   readlinesearchr=   rY   )r&   patternr>   r?   r!   r@   rF   rG   rB   matchliner'   r'   r(   
search_cpp   s     	


zconfig.search_cppc             C   sd   ddl m} | j  y| j|||| d}W n |k
rD   d}Y nX tj|rRdpTd | j  |S )Nr   )rZ   TFzsuccess!zfailure.)r5   rZ   r6   rL   r   rT   rY   )r&   r>   r?   r!   r@   rZ   r[   r'   r'   r(   try_compile   s    
zconfig.try_compilec       
      C   sp   ddl m}m} | j  y| j|||||| d}	W n ||fk
rP   d}	Y nX tj|	r^dp`d | j  |	S )Nr   )rZ   	LinkErrorTFzsuccess!zfailure.)r5   rZ   rf   r6   rR   r   rT   rY   )
r&   r>   r?   r!   r"   r#   r@   rZ   rf   r[   r'   r'   r(   try_link   s    


zconfig.try_linkc             C   s   ddl m}m} | j  y.| j||||||\}	}
}| j|g d}W n ||tfk
rd   d}Y nX tj|rrdptd | j	  |S )Nr   )rZ   rf   TFzsuccess!zfailure.)
r5   rZ   rf   r6   rR   Zspawnr   r   rT   rY   )r&   r>   r?   r!   r"   r#   r@   rZ   rf   rF   rK   Zexer[   r'   r'   r(   try_run   s    

zconfig.try_runr   c       	      C   st   | j   g }|r|jd|  |jd |r<|jd|  n|jd|  |jd dj|d }| j|||||S )Nz
int %s ();zint main () {z  %s();z  %s;}r8   )r6   rP   rU   rg   )	r&   funcr?   r!   r"   r#   ZdeclZcallr>   r'   r'   r(   
check_func  s    


zconfig.check_funcc             C   s    | j   | jd|||g| |S )Nzint main (void) { })r6   rg   )r&   Zlibraryr#   r?   r!   Zother_librariesr'   r'   r(   	check_lib6  s    

zconfig.check_libc             C   s   | j d|g|dS )Nz/* No body */)r>   r?   r!   )r\   )r&   rC   r!   r#   r@   r'   r'   r(   check_headerD  s    
zconfig.check_header)r   Nr	   )r
   Nr   )r   r   r   )r   r   r   )r   r   r   )r   r   r   )r   r   r   )r   Nr   )r   Nr   )NNNr   )NNNr   )NNr   )NNNNr   )NNNNr   )NNNNr   r   )NNr   )__name__
__module____qualname__descriptionZuser_optionsr)   r/   r0   r6   rD   rH   rL   rR   rY   r\   rd   re   rg   rh   rk   rl   rm   r'   r'   r'   r(   r      sT            	
 

 
 
 
 r   c          
   C   sJ   |d krt jd|  n
t j| t| }zt j|j  W d |j  X d S )Nz%s)r   rT   r;   readr=   )rA   headrB   r'   r'   r(   rI   N  s    
rI   )N)r-   r^   Zdistutils.corer   Zdistutils.errorsr   Zdistutils.sysconfigr   Z	distutilsr   r:   r   rI   r'   r'   r'   r(   <module>   s   
  ;