Your IP : 3.142.195.79


Current Path : /opt/alt/python34/lib64/python3.4/distutils/__pycache__/
Upload File :
Current File : //opt/alt/python34/lib64/python3.4/distutils/__pycache__/bcppcompiler.cpython-34.pyo

�
h fW:�@s�dZddlZddlmZmZmZmZmZmZddl	m
Z
mZmZddl
mZddlmZddlmZGdd	�d	e
�ZdS)
z�distutils.bcppcompiler

Contains BorlandCCompiler, an implementation of the abstract CCompiler class
for the Borland C++ compiler.
�N)�DistutilsExecError�DistutilsPlatformError�CompileError�LibError�	LinkError�UnknownFileError)�	CCompiler�gen_preprocess_options�gen_lib_options)�
write_file)�newer)�logc@seZdZdZdZiZdgZdddgZeeZdZ	dZ
d	Zd
ZZ
dZdddd
d�Zddddddddd�Zddddd�Zdddddddddddd�
Zddd�Zdddd�Zddddddd�ZdS)�BCPPCompilerzConcrete class that implements an interface to the Borland C/C++
    compiler, as defined by the CCompiler abstract class.
    Zbcppz.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�;/opt/alt/python34/lib64/python3.4/distutils/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�qvn|dkrZy|jdd|
|g�Wqvtk
rS}zt
|��WYdd}~XqvXqvn||jkrrd}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|}|rXny|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-)	rr0Zoutput_libnamer*r-�target_lang�output_filenameZlib_argsr5rrr�create_static_lib�s"zBCPPCompiler.create_static_libc Cs�|j||�\}}|j|||�\}}}|rUtjdt|��n|dk	rytjj||�}n|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|��qXW|jd�|j|�|jd
|g�|jd�xL|D]D}|j|||	�}|dkr�|j|�q�|j|�q�W|jd�|jd�|jd
|g�|jd
�|j|�|
rh|
|dd�<n|r~|j|�n|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)) 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	Cs�|r-|d}|d|d||f}n|d|f}xW|D]K}xB|D]:}tjj||j|��}tjj|�rQ|SqQWqDWdSdS)NZ_dZ_bcpp)r"r#r@r8�exists)	r�dirsrr-ZdlibZ	try_names�dir�namerMrrrrE4s



zBCPPCompiler.find_library_filercCs"|dkrd}ng}x|D]�}tjjtjj|��\}}||jddgkr~td||f��n|r�tjj|�}n|dkr�|jtjj|||��q"|dkr�|jtjj||d��q"|jtjj|||j	��q"W|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_filenamescCs2|jd||�\}}}t||�}dg|}	|dk	rZ|	jd|�n|rs||	dd�<n|r�|	j|�n|	j|�|js�|dks�t||�r.|r�|jtjj	|��ny|j
|	�Wq.tk
r*}
zt|
�t
|
��WYdd}
~
Xq.XndS)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)�__name__�
__module__�__qualname__�__doc__Z
compiler_typeZexecutablesr(r)rSrUZstatic_lib_extensionZshared_lib_extensionZstatic_lib_formatZshared_lib_formatZ
exe_extensionrr6r<rNrErVrZrrrrrsJ	

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

?>