File: //lib64/python3.6/distutils/__pycache__/bcppcompiler.cpython-36.pyc
3
  \W:  �               @   sx   d Z ddlZddlmZmZmZmZmZmZ ddl	m
Z
mZmZ ddl
mZ ddlmZ ddlmZ G dd	� 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            
   @   s�   e Zd ZdZdZi ZdgZdddgZee ZdZ	dZ
d	Zd
 ZZ
dZdd
d�Zddd�Zddd�Zd dd�Zd!dd�Zd"dd�Zd#dd�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.exer   c             C   s�   t j| |||� d| _d| _d| _d | _ddddg| _ddddg| _d	d
ddg| _d	d
ddg| _	g | _
d
ddg| _d
dddg| _d S )
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.pyr   5   s    zBCPPCompiler.__init__Nc	             C   s�  | j ||||||�\}}	}}
}|p$g }|jd� |rB|j| j� n|j| j� �xD|	D �]:}
y||
 \}}W n tk
r�   wVY nX tjj|�}tjj|
�}
| j	tjj
|
�� |dkr�qV|dk�ry| jdd|
|g� W qV tk
�r } zt
|��W Y d d }~X qVX qV|| jk�rd}n|| jk�r,d}nd}d|
 }y,| j| jg| |
 ||g | |g � W qV tk
�r� } zt
|��W Y d d }~X qVX qVW |	S )	Nz-cz.resz.rcZbrcc32z-fo� z-Pz-o)Z_setup_compile�append�extendr   r   �KeyError�os�path�normpath�mkpath�dirname�spawnr   r   �
_c_extensions�_cpp_extensionsr   )r   Zsources�
output_dir�macros�include_dirs�debug�
extra_preargs�extra_postargsZdepends�objects�pp_optsZbuildZcompile_opts�obj�src�ext�msgZ	input_optZ
output_optr   r   r   �compileQ   sF    
(zBCPPCompiler.compilec       	      C   s�   | j ||�\}}| j||d�}| j||�r~|dg| }|r:y| j| jg| � W q� tk
rz } zt|��W Y d d }~X q�X ntjd|� d S )N)r*   z/uzskipping %s (up-to-date))	�_fix_object_args�library_filename�
_need_linkr'