Your IP : 3.133.145.168


Current Path : /opt/alt/python35/lib64/python3.5/distutils/__pycache__/
Upload File :
Current File : //opt/alt/python35/lib64/python3.5/distutils/__pycache__/bcppcompiler.cpython-35.opt-2.pyc



���]W:�@s�ddlZddlmZmZmZmZmZmZddlm	Z	m
Z
mZddlm
Z
ddlmZddlmZGdd�de	�ZdS)	�N)�DistutilsExecError�DistutilsPlatformError�CompileError�LibError�	LinkError�UnknownFileError)�	CCompiler�gen_preprocess_options�gen_lib_options)�
write_file)�newer)�logc@seZdZdZiZdgZdddgZeeZdZdZ	dZ
d	ZZd
Z
ddddd
�Zddddddddd�Zddddd�Zdddddddddddd�
Zddd�Zdddd�Zddddddd�ZdS)�BCPPCompilerZbcppz.cz.ccz.cppz.cxxz.objz.libz.dllz%s%sz.exercCs�tj||||�d|_d|_d|_d|_ddddg|_ddddg|_d	d
ddg|_d	d
ddg|_	g|_
d
ddg|_d
dddg|_dS)
Nz	bcc32.exezilink32.exeztlib.exez/tWMz/O2z/qz/g0z/Odz/Tpdz/Gnz/xz/r)
r�__init__�cc�linker�libZpreprocess_options�compile_options�compile_options_debug�ldflags_shared�ldflags_shared_debugZldflags_static�ldflags_exe�ldflags_exe_debug)�self�verbose�dry_run�force�r�1/opt/alt/python35/lib64/python3.5/bcppcompiler.pyr5s					zBCPPCompiler.__init__Nc	Cs|j||||||�\}}	}}
}|p6g}|jd�|r_|j|j�n|j|j�x�|	D]�}
y||
\}}Wntk
r�wvYnXtjj|�}tjj|
�}
|j	tjj
|
��|dkr�qv|dkrTy|jdd|
|g�Wqvtk
rP}zt
|��WYdd}~XqvXqv||jkrld}n||jkr�d}nd}d|
}y4|j|jg||
||g||g�Wqvtk
r�}zt
|��WYdd}~XqvXqvW|	S)	Nz-cz.resz.rcZbrcc32z-fo�z-Pz-o)Z_setup_compile�append�extendrr�KeyError�os�path�normpath�mkpath�dirname�spawnrr�
_c_extensions�_cpp_extensionsr)rZsources�
output_dir�macros�include_dirs�debug�
extra_preargs�extra_postargsZdepends�objects�pp_optsZbuildZcompile_opts�obj�src�ext�msgZ	input_optZ
output_optrrr�compileQsF


		
.#zBCPPCompiler.compilec	Cs�|j||�\}}|j|d|�}|j||�r�|dg|}|rUy|j|jg|�Wq�tk
r�}zt|��WYdd}~Xq�Xntjd|�dS)Nr+z/uzskipping %s (up-to-date))	�_fix_object_args�library_filename�
_need_linkr(rrrr
r.)	rr1Zoutput_libnamer+r.�target_lang�output_filenameZlib_argsr6rrr�create_static_lib�s"zBCPPCompiler.create_static_libc Cs�|j||�\}}|j|||�\}}}|rRtjdt|��|dk	rstjj||�}|j||�r�|t	j
kr�d}|	r�|jdd�}q|jdd�}n5d}|	r�|j
dd�}n|jdd�}|dkrd}n�tjj|�\}}tjj|�\}}tjj|d�}tjj|d|�}dg}x+|p�gD]}|jd||f�q�W|jt||fd	|�ttjj|�}|g}g}x[|D]S}tjjtjj|��\}}|d
kr:|j|�q�|j|�q�Wx+|D]#}|jdtjj|��qRW|jd�|j|�|jd
|g�|jd�xL|D]D}|j|||	�}|dkr�|j|�q�|j|�q�W|jd�|jd�|jd
|g�|jd
�|j|�|
r_|
|dd�<|rr|j|�|jtjj|��y|j|jg|�Wq�tk
r�}zt|��WYdd}~Xq�Xntjd|�dS)Nz7I don't know what to do with 'runtime_library_dirs': %sZc0w32Zc0d32rrz%s.defZEXPORTSz  %s=_%sz
writing %sz.resz/L%sz/L.�,z,,Zimport32Zcw32mtzskipping %s (up-to-date)) r8Z
_fix_lib_argsr
�warn�strr#r$�joinr:rZ
EXECUTABLErrrr�split�splitextr'r Zexecuter�mapr%�normcaser!�find_library_filer&r(rrrr.) rZtarget_descr1r<r+Z	librariesZlibrary_dirsZruntime_library_dirsZexport_symbolsr.r/r0Z
build_tempr;Zstartup_objZld_argsZdef_file�head�tail�modnamer5Ztemp_dir�contentsZsymZobjects2Z	resources�file�base�lr�libfiler6rrr�link�s|	
			
$
!









"zBCPPCompiler.linkc	Cs�|r-|d}|d|d||f}n|d|f}xW|D]K}xB|D]:}tjj||j|��}tjj|�rQ|SqQWqDWdSdS)NZ_dZ_bcpp)r#r$rAr9�exists)	r�dirsrr.ZdlibZ	try_names�dir�namerNrrrrF4s



zBCPPCompiler.find_library_filercCs|dkrd}g}x�|D]�}tjjtjj|��\}}||jddgkrxtd||f��|r�tjj|�}|dkr�|jtjj|||��q|dkr�|jtjj||d��q|jtjj|||j	��qW|S)Nrz.rcz.resz"unknown file type '%s' (from '%s'))
r#r$rCrE�src_extensionsr�basenamer rA�
obj_extension)rZsource_filenamesZ	strip_dirr+Z	obj_namesZsrc_namerLr5rrr�object_filenamesNs"
$##zBCPPCompiler.object_filenamescCs#|jd||�\}}}t||�}dg|}	|dk	rW|	jd|�|rm||	dd�<|r�|	j|�|	j|�|js�|dks�t||�r|r�|jtjj	|��y|j
|	�Wn;tk
r}
zt|
�t
|
��WYdd}
~
XnXdS)Nz	cpp32.exez-or)Z_fix_compile_argsr	r r!rrr&r#r$r'r(r�printr)r�sourceZoutput_filer,r-r/r0�_r2Zpp_argsr6rrr�
preprocessis$	


$
zBCPPCompiler.preprocess)�__name__�
__module__�__qualname__Z
compiler_typeZexecutablesr)r*rTrVZstatic_lib_extensionZshared_lib_extensionZstatic_lib_formatZshared_lib_formatZ
exe_extensionrr7r=rOrFrWr[rrrrrsH	

B|r)r#Zdistutils.errorsrrrrrrZdistutils.ccompilerrr	r
Zdistutils.file_utilrZdistutils.dep_utilrZ	distutilsr
rrrrr�<module>s.

?>