File: //opt/alt/python35/lib64/python3.5/distutils/__pycache__/bcppcompiler.cpython-35.opt-1.pyc
��YfW:  �               @   s�   d  Z  d d l Z d d l m Z m Z m Z m Z m Z m Z d d l	 m
 Z
 m Z m Z d d l
 m Z d d l m Z d d l m Z Gd d	 �  d	 e
 � Z d S)
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  Z d  Z d Z d Z i  Z d g Z d d d g Z e e Z d Z	 d Z
 d	 Z d
 Z Z
 d Z d d d d
 d � Z d d d d d d d d d � Z d d d d d � Z d d d d d d d d d d d d �
 Z d d d � Z d d d d � Z d d d d d d d � Z d S)�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  |  _ d d d d g |  _ d d d d g |  _ d	 d
 d d g |  _ d	 d
 d d g |  _	 g  |  _
 d
 d d g |  _ d
 d d d g |  _ 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   �;/opt/alt/python35/lib64/python3.5/distutils/bcppcompiler.pyr   5   s    					zBCPPCompiler.__init__Nc	             C   s  |  j  | | | | | | � \ } }	 } }
 } | p6 g  } | j d � | r_ | j |  j � n | j |  j � x�|	 D]�}
 y | |
 \ } } Wn t k
 r� wv Yn Xt j j | � } t j j |
 � }
 |  j	 t j j
 |
 � � | d k r� qv | d k rTy |  j d d |
 | g � Wqv t k
 rP} z t
 | � � WYd  d  } ~ Xqv Xqv | |  j k rld } n | |  j k r�d } n d } d |
 } y4 |  j |  j g | |
 | | g | | g � Wqv t k
 r�} z t
 | � � WYd  d  } ~ Xqv Xqv W|	 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� | d g | } | rU y |  j |  j g | � Wq� t k
 r� } z t | � � WYd  d  } ~ Xq� Xn t j d | � d  S)Nr*   z/uzskipping %s (up-to-date))	�_fix_object_args�library_filename�
_need_linkr'