Your IP : 18.188.218.219


Current Path : /opt/alt/python36/lib64/python3.6/distutils/command/__pycache__/
Upload File :
Current File : //opt/alt/python36/lib64/python3.6/distutils/command/__pycache__/config.cpython-36.opt-2.pyc

3

��2a3�@shddlZddlZddlmZddlmZddlmZddlm	Z	ddd�Z
Gd	d
�d
e�Zd
dd�ZdS)�N)�Command)�DistutilsExecError)�customize_compiler)�logz.cz.cxx)�czc++c@s�eZdZdZd>d?d@dAdBdCdDdEdFg	Zdd�Zdd�Zdd�Zd d!�Zd"d#�Z	d$d%�Z
d&d'�Zd(d)�Zd*d+�Z
dGd-d.�ZdHd/d0�ZdId1d2�ZdJd3d4�ZdKd5d6�ZdLd8d9�Zdddgfd:d;�ZdMd<d=�ZdS)N�configzprepare 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�noisy�1show every action (compile, link, run, ...) taken�dump-source�=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'�+/opt/alt/python36/lib64/python3.6/config.py�initialize_options3szconfig.initialize_optionscCs�|jdkr|jjpg|_nt|jt�r6|jjtj�|_|jdkrHg|_nt|jt�r^|jg|_|jdkrpg|_nt|jt�r�|jjtj�|_dS)N)	r!Zdistribution�
isinstance�str�split�os�pathsepr"r#)r&r'r'r(�finalize_optionsBs



zconfig.finalize_optionscCsdS)Nr')r&r'r'r(�runRsz
config.runcCszddlm}m}t|j|�sv||j|jdd�|_t|j�|jrN|jj|j�|j	rb|jj
|j	�|jrv|jj|j�dS)Nr)�	CCompiler�new_compilerr)r �dry_run�force)
�distutils.ccompilerr1r2r*r r3rr!Zset_include_dirsr"Z
set_librariesr#Zset_library_dirs)r&r1r2r'r'r(�_check_compilerYs
zconfig._check_compilercCsldt|}t|d�}|r@x|D]}|jd|�q W|jd�|j|�|ddkr`|jd�|j�|S)NZ_configtest�wz#include <%s>
�
r���)�LANG_EXT�open�write�close)r&�body�headers�lang�filename�file�headerr'r'r(�_gen_temp_sourcefileks




zconfig._gen_temp_sourcefilecCs<|j|||�}d}|jj||g�|jj|||d�||fS)Nz
_configtest.i)r!)rDr%�extendr Z
preprocess)r&r>r?r!r@�src�outr'r'r(�_preprocessxs
zconfig._preprocesscCs\|j|||�}|jr"t|d|�|jj|g�\}|jj||g�|jj|g|d�||fS)Nzcompiling '%s':)r!)rDr$�	dump_filer Zobject_filenamesr%rE�compile)r&r>r?r!r@rF�objr'r'r(�_compileszconfig._compilec
Csr|j||||�\}}tjjtjj|��d}	|jj|g|	|||d�|jjdk	r\|	|jj}	|jj	|	�|||	fS)Nr)r"r#Ztarget_lang)
rLr-�path�splitext�basenamer Zlink_executableZ
exe_extensionr%�append)
r&r>r?r!r"r#r@rFrK�progr'r'r(�_link�szconfig._linkcGsX|s|j}g|_tjddj|��x0|D](}ytj|�Wq(tk
rNYq(Xq(WdS)Nzremoving: %s� )r%r�info�joinr-�remove�OSError)r&�	filenamesrAr'r'r(�_clean�s
z
config._cleanrcCsRddlm}|j�d}y|j||||�Wn|k
rDd}YnX|j�|S)Nr)�CompileErrorTF)r5rZr6rHrY)r&r>r?r!r@rZ�okr'r'r(�try_cpp�s
zconfig.try_cppcCsx|j�|j||||�\}}t|t�r0tj|�}t|�}d}	x&|j�}
|
dkrPP|j|
�r>d}	Pq>W|j	�|j
�|	S)NF�T)r6rHr*r+�rerJr;�readline�searchr=rY)r&�patternr>r?r!r@rFrGrB�match�liner'r'r(�
search_cpp�s 	


zconfig.search_cppcCsdddlm}|j�y|j||||�d}Wn|k
rDd}YnXtj|rRdpTd�|j�|S)Nr)rZTFzsuccess!zfailure.)r5rZr6rLrrTrY)r&r>r?r!r@rZr[r'r'r(�try_compile�s
zconfig.try_compilec

Cspddlm}m}|j�y|j||||||�d}	Wn||fk
rPd}	YnXtj|	r^dp`d�|j�|	S)Nr)rZ�	LinkErrorTFzsuccess!zfailure.)r5rZrfr6rRrrTrY)
r&r>r?r!r"r#r@rZrfr[r'r'r(�try_link�s


zconfig.try_linkc

Cs�ddlm}m}|j�y.|j||||||�\}	}
}|j|g�d}Wn||tfk
rdd}YnXtj|rrdptd�|j	�|S)Nr)rZrfTFzsuccess!zfailure.)
r5rZrfr6rRZspawnrrrTrY)
r&r>r?r!r"r#r@rZrfrFrKZexer[r'r'r(�try_run�s

zconfig.try_runrc	Cst|j�g}|r|jd|�|jd�|r<|jd|�n|jd|�|jd�dj|�d}|j|||||�S)Nz
int %s ();z
int main () {z  %s();z  %s;�}r8)r6rPrUrg)	r&�funcr?r!r"r#ZdeclZcallr>r'r'r(�
check_funcs


zconfig.check_funccCs |j�|jd|||g||�S)Nzint main (void) { })r6rg)r&Zlibraryr#r?r!Zother_librariesr'r'r(�	check_lib6s

zconfig.check_libcCs|jd|g|d�S)Nz
/* No body */)r>r?r!)r\)r&rCr!r#r@r'r'r(�check_headerDs
zconfig.check_header)rNr	)r
Nr)rr
r)rrr)rrr)rrr)rrr)rNr)rNr)NNNr)NNNr)NNr)NNNNr)NNNNr)NNNNrr)NNr)�__name__�
__module__�__qualname__�descriptionZuser_optionsr)r/r0r6rDrHrLrRrYr\rdrergrhrkrlrmr'r'r'r(rsT
	






rc
CsJ|dkrtjd|�n
tj|�t|�}ztj|j��Wd|j�XdS)Nz%s)rrTr;�readr=)rA�headrBr'r'r(rINs
rI)N)
r-r^Zdistutils.corerZdistutils.errorsrZdistutils.sysconfigrZ	distutilsrr:rrIr'r'r'r(�<module>s
;

?>