Your IP : 18.225.54.147


Current Path : /lib64/python3.8/distutils/__pycache__/
Upload File :
Current File : //lib64/python3.8/distutils/__pycache__/bcppcompiler.cpython-38.opt-2.pyc

U

e5dW:�@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�t�||||�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.8/distutils/bcppcompiler.pyr5szBCPPCompiler.__init__Nc	Cs�|�||||||�\}}	}}
}|p$g}|�d�|rB|�|j�n|�|j�|	D�]<}
z||
\}}Wntk
r�YqRYnXtj�|�}tj�|
�}
|�	tj�
|
��|dkr�qR|dk�rz|�dd|
|g�WqRtk
�r}zt
|��W5d}~XYqRXqR||jk�rd}n||jk�r*d}nd}d|
}z,|�|jg||
||g||g�WqRtk
�r�}zt
|��W5d}~XYqRXqR|	S)	Nz-c�.res�.rcZbrcc32z-fo�z-P�-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�compileQsV��



���
zBCPPCompiler.compilec	
Cs�|�||�\}}|j||d�}|�||�r~|dg|}|r:z|�|jg|�Wq�tk
rz}zt|��W5d}~XYq�Xnt�d|�dS)N)r-z/u�skipping %s (up-to-date))	�_fix_object_args�library_filename�
_need_linkr*rrrr
r0)	rr3Zoutput_libnamer-r0�target_lang�output_filenameZlib_argsr8rrr�create_static_lib�s�zBCPPCompiler.create_static_libc 
Cs�|�||�\}}|�|||�\}}}|r8t�dt|��|dk	rNtj�||�}|�||��r�|t	j
kr�d}|	r~|jdd�}q�|jdd�}n&d}|	r�|j
dd�}n|jdd�}|dkr�d}n�tj�|�\}}tj�|�\}}tj�|d�}tj�|d|�}dg}|�pgD]}|�d||f��q|�t||fd	|�ttjj|�}|g}g}|D]>}tj�tj�|��\}}|d
k�r�|�|�n
|�|��q`|D]}|�dtj�|���q�|�d�|�|�|�d
|g�|�d�|D]4}|�|||	�}|dk�r|�|�n
|�|��q�|�d�|�d�|�d
|g�|�d
�|�|�|
�rp|
|dd�<|�r�|�|�|�tj�|��z|�|jg|�Wn,tk
�r�}zt|��W5d}~XYnXnt�d|�dS)Nz7I don't know what to do with 'runtime_library_dirs': %sZc0w32Zc0d32r rz%s.defZEXPORTSz  %s=_%sz
writing %srz/L%sz/L.�,z,,Zimport32Zcw32mtr:) r;Z
_fix_lib_argsr
�warn�strr%r&�joinr=rZ
EXECUTABLErrrr�split�splitextr)r"Zexecuter�mapr'�normcaser#�find_library_filer(r*rrrr0) rZtarget_descr3r?r-Z	librariesZlibrary_dirsZruntime_library_dirsZexport_symbolsr0r1r2Z
build_tempr>Zstartup_objZld_argsZdef_file�head�tail�modnamer7Ztemp_dir�contentsZsymZobjects2Z	resources�file�base�lr�libfiler8rrr�link�s���
�










zBCPPCompiler.linkc	Csr|r"|d}|d|d||f}n|d|f}|D]:}|D]0}tj�||�|��}tj�|�r:|Sq:q2dS)NZ_dZ_bcpp)r%r&rDr<�exists)	r�dirsrr0ZdlibZ	try_names�dir�namerQrrrrI4s
zBCPPCompiler.find_library_filer cCs�|dkrd}g}|D]�}tj�tj�|��\}}||jddgkrRtd||f��|rbtj�|�}|dkr�|�tj�|||��q|dkr�|�tj�||d��q|�tj�|||j	��q|S)Nr rrz"unknown file type '%s' (from '%s'))
r%r&rFrH�src_extensionsr�basenamer"rD�
obj_extension)rZsource_filenamesZ	strip_dirr-Z	obj_namesZsrc_namerOr7rrr�object_filenamesNs&��zBCPPCompiler.object_filenamesc
Cs�|�d||�\}}}t||�}dg|}	|dk	r>|	�d|�|rN||	dd�<|r\|	�|�|	�|�|js~|dks~t||�r�|r�|�tj�	|��z|�
|	�Wn2tk
r�}
zt|
�t
|
��W5d}
~
XYnXdS)Nz	cpp32.exer!r)Z_fix_compile_argsr	r"r#rrr(r%r&r)r*r�printr)r�sourceZoutput_filer.r/r1r2�_r4Zpp_argsr8rrr�
preprocessis&	�



zBCPPCompiler.preprocess)rrr)NNNrNNN)NrN)
NNNNNrNNNN)r)rr )NNNNN)�__name__�
__module__�__qualname__Z
compiler_typeZexecutablesr+r,rWrYZstatic_lib_extensionZshared_lib_extensionZstatic_lib_formatZshared_lib_formatZ
exe_extensionrr9r@rRrIrZr^rrrrrs`
�
�
D�
�


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

?>