Your IP : 18.117.184.236


Current Path : /usr/lib64/python3.6/distutils/__pycache__/
Upload File :
Current File : //usr/lib64/python3.6/distutils/__pycache__/bcppcompiler.cpython-36.opt-2.pyc

3


 \W:�@stddlZddlmZmZmZmZmZmZddlm	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
@s�eZdZdZiZdgZdddgZeeZdZdZ	dZ
d	ZZd
Z
ddd
�Zddd�Zddd�Zddd�Zd dd�Zd!dd�Zd"dd�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�verboseZdry_run�force�r�./usr/lib64/python3.6/distutils/bcppcompiler.pyr5szBCPPCompiler.__init__Nc	Cs�|j||||||�\}}	}}
}|p$g}|jd�|rB|j|j�n|j|j��xD|	D�]:}
y||
\}}Wntk
r�wVYnXtjj|�}tjj|
�}
|j	tjj
|
��|dkr�qV|dk�ry|jdd|
|g�WqVtk
�r}zt
|��WYdd}~XqVXqV||jk�rd}n||jk�r,d}nd}d|
}y,|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|}|r:y|j|jg|�Wq�tk
rz}zt|��WYdd}~Xq�Xntjd|�dS)N)r*z/uzskipping %s (up-to-date))	�_fix_object_args�library_filename�
_need_linkr'rrrr
r-)	rr0Zoutput_libnamer*r-�target_lang�output_filenameZlib_argsr5rrr�create_static_lib�szBCPPCompiler.create_static_libc Cs�|j||�\}}|j|||�\}}}|r8tjdt|��|dk	rNtjj||�}|j||��r�|t	j
kr�d}|	r~|jdd�}q�|jdd�}n&d}|	r�|j
dd�}n|jdd�}|dkr�d}n�tjj|�\}}tjj|�\}}tjj|d�}tjj|d|�}dg}x&|�pgD]}|jd||f��qW|jt||fd	|�ttjj|�}|g}g}xF|D]>}tjjtjj|��\}}|d
k�r�|j|�n
|j|��qfWx$|D]}|jdtjj|���q�W|jd�|j|�|jd
|g�|jd�x<|D]4}|j|||	�}|dk�r(|j|�n
|j|��qW|jd�|jd�|jd
|g�|jd
�|j|�|
�r�|
|dd�<|�r�|j|�|jtjj|��y|j|jg|�Wn,tk
�r�}zt|��WYdd}~XnXntjd|�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)) r7Z
_fix_lib_argsr
�warn�strr"r#�joinr9rZ
EXECUTABLErrrr�split�splitextr&rZexecuter�mapr$�normcaser �find_library_filer%r'rrrr-) rZtarget_descr0r;r*Z	librariesZlibrary_dirsZruntime_library_dirsZexport_symbolsr-r.r/Z
build_tempr:Zstartup_objZld_argsZdef_file�head�tail�modnamer4Ztemp_dir�contentsZsymZobjects2Z	resources�file�base�lr�libfiler5rrr�link�s|
















zBCPPCompiler.linkc	Csv|r"|d}|d|d||f}n|d|f}xB|D]6}x0|D](}tjj||j|��}tjj|�r>|Sq>Wq4WdSdS)NZ_dZ_bcpp)r"r#r@r8�exists)	r�dirsrr-ZdlibZ	try_names�dir�namerMrrrrE4s


zBCPPCompiler.find_library_filercCs�|dkrd}g}x�|D]�}tjjtjj|��\}}||jddgkrTtd||f��|rdtjj|�}|dkr�|jtjj|||��q|dkr�|jtjj||d��q|jtjj|||j	��qW|S)Nrz.rcz.resz"unknown file type '%s' (from '%s'))
r"r#rBrD�src_extensionsr�basenamerr@�
obj_extension)rZsource_filenamesZ	strip_dirr*Z	obj_namesZsrc_namerKr4rrr�object_filenamesNs"
zBCPPCompiler.object_filenamescCs�|jd||�\}}}t||�}dg|}	|dk	r>|	jd|�|rN||	dd�<|r\|	j|�|	j|�|js~|dks~t||�r�|r�|jtjj	|��y|j
|	�Wn2tk
r�}
zt|
�t
|
��WYdd}
~
XnXdS)Nz	cpp32.exez-or)Z_fix_compile_argsr	rr rrr%r"r#r&r'r�printr)r�sourceZoutput_filer+r,r.r/�_r1Zpp_argsr5rrr�
preprocessis$	



zBCPPCompiler.preprocess)rrr)NNNrNNN)NrN)
NNNNNrNNNN)r)rr)NNNNN)�__name__�
__module__�__qualname__Z
compiler_typeZexecutablesr(r)rSrUZstatic_lib_extensionZshared_lib_extensionZstatic_lib_formatZshared_lib_formatZ
exe_extensionrr6r<rNrErVrZrrrrrsH


B

|

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

?>