<!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>
a
    XC?h=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g 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dd„ Zd(dd„Zd)dd„Zd*dd„Zd+dd„Zd,dd „Zd-d"d#„Zdddg fd$d%„Zd.d&d'„ZdS )/Ú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/python39/lib64/python3.9/distutils/command/config.pyÚinitialize_options3   s    zconfig.initialize_optionsc                 C   s   | j d u r| jj pg | _ nt| j tƒr6| j  tj¡| _ | jd u rHg | _nt| jtƒr^| jg| _| jd u 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   s€   dt |  }t|dƒV}|r>|D ]}| d| ¡ q | d¡ | |¡ |d dkr^| d¡ W d   ƒ n1 sr0    Y  |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 u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   sR   |s| j }g | _ t dd |¡¡ |D ]&}zt |¡ W q& tyJ   Y q&0 q&d S )Nzremoving: %sú )r   r   ÚinfoÚjoinr   ÚremoveÚOSError)r   Ú	filenamesr0   r   r   r   Ú_clean–   s    zconfig._cleanNr   c                 C   sP   ddl m} |  ¡  d}z|  ||||¡ W n |yB   d}Y n0 |  ¡  |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   sŒ   |   ¡  |  ||||¡\}}t|tƒr0t |¡}t|ƒ8}d}	| ¡ }
|
dkrPqb| |
¡r>d}	qbq>W d   ƒ n1 sv0    Y  |  	¡  |	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   sb   ddl m} |  ¡  z|  ||||¡ d}W n |yB   d}Y n0 t |rPdpRd¡ |  ¡  |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   sn   ddl m}m} |  ¡  z|  ||||||¡ d}	W n ||fyN   d}	Y n0 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yb   d}Y n0 t |rpdprd¡ |  	¡  |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   sR   |d u rt  d| ¡ n
t  |¡ t| ƒ}zt  | ¡ ¡ W | ¡  n
| ¡  0 d S )Nz%s)r   rD   r+   ÚreadÚclose)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