��Qc@s�dZdZddlZddlmZmZmZmZmZddl m
Z
mZddlm
Z
ddlmZddlmZd e
fd
��YZdS(s�distutils.bcppcompiler
Contains BorlandCCompiler, an implementation of the abstract CCompiler class
for the Borland C++ compiler.
s$Id$i�N(tDistutilsExecErrortCompileErrortLibErrort LinkErrortUnknownFileError(t CCompilertgen_preprocess_options(t
write_file(tnewer(tlogtBCPPCompilercBs�eZdZdZiZdgZdddgZeeZdZdZ dZ
d ZZd
Z
dddd�Zdddddddd
�Zdddd�Zddddddddddd�Zdd�Zddd�Zdddddd�ZRS(sConcrete class that implements an interface to the Borland C/C++
compiler, as defined by the CCompiler abstract class.
tbcpps.cs.ccs.cpps.cxxs.objs.libs.dlls%s%ss.exeicCs�tj||||�d|_d|_d|_d|_ddddg|_ddddg|_d d
ddg|_ d d
ddg|_
g|_d
ddg|_d
dddg|_
dS(
Ns bcc32.exesilink32.exestlib.exes/tWMs/O2s/qs/g0s/Ods/Tpds/Gns/xs/r(Rt__init__tcctlinkertlibtNonetpreprocess_optionstcompile_optionstcompile_options_debugtldflags_sharedtldflags_shared_debugtldflags_statictldflags_exetldflags_exe_debug(tselftverbosetdry_runtforce((s,/sys/lib/python2.7/distutils/bcppcompiler.pyR5s c Cs�|j||||||�\}} }}
}|p6g}|jd�|r_|j|j�n|j|j�xi| D]a}
y||
\}}Wntk
r�qvnXtjj|�}tjj|
�}
|j tjj
|
��|dkr�n|dkrDy|jdd|
|g�Wqvtk
r=}t
|�qvXqvn||jkr\d}n||jkrtd}nd}d|
}y4|j|jg||
||g||g�Wqvtk
r�}t
|�qvXqvW| S( Ns-cs.ress.rctbrcc32s-fots-Ps-o(t_setup_compiletappendtextendRRtKeyErrortostpathtnormpathtmkpathtdirnametspawnRRt
_c_extensionst_cpp_extensionsR
(Rtsourcest
output_dirtmacrostinclude_dirstdebugt
extra_preargstextra_postargstdependstobjectstpp_optstbuildtcompile_optstobjtsrctexttmsgt input_optt
output_opt((s,/sys/lib/python2.7/distutils/bcppcompiler.pytcompileQsF
.c Cs�|j||�\}}|j|d|�}|j||�r�|dg|}|rXny|j|jg|�Wq�tk
r�}t|�q�Xntjd|�dS(NR,s/usskipping %s (up-to-date)( t_fix_object_argstlibrary_filenamet
_need_linkR(RRRR R/( RR3toutput_libnameR,R/ttarget_langtoutput_filenametlib_argsR:((s,/sys/lib/python2.7/distutils/bcppcompiler.pytcreate_static_lib�sc Cs�|j||�\}}|j|||�\}}}|rUtjdt|��n|dk rytjj||�}n|j ||�r�|t
jkr�d}| r�|j}q�j
}n#d}| r�|j}n
|j}|dkr�}n�tjj|�\}}tjj|�\}}tjj|d�}tjj|d|�}dg}x+|plgD]}|jd||f�qmW|jt||fd |�ttjj|�}|g}g}x[|D]S}tjjtjj|��\}}|d
kr|j|�q�|j|�q�Wx+|D]#}|jdtjj|��q4W|jd�|j|�|jd
|g�|jd�xL|D]D}|j||| �}|dkr�|j|�q�|j|�q�W|jd�|jd�|jd
|g�|jd
�|j|�|
r>|
|d*n|rT|j|�n|jtjj|��y|j|jg|�Wq�tk
r�}t|�q�Xntj d|�dS(Ns7I don't know what to do with 'runtime_library_dirs': %stc0w32tc0d32Ris%s.deftEXPORTSs %s=_%ss
writing %ss.ress/L%ss/L.t,s,,timport32tcw32mtsskipping %s (up-to-date)(!R>t
_fix_lib_argsR twarntstrRR#R$tjoinR@Rt
EXECUTABLERRRRtsplittsplitextR'R texecuteRtmapR%tnormcaseR!tfind_library_fileR&R(RRRR/( Rttarget_descR3RCR,t librariestlibrary_dirstruntime_library_dirstexport_symbolsR/R0R1t
build_tempRBtstartup_objtld_argstdef_filetheadttailtmodnameR9ttemp_dirtcontentstsymtobjects2t resourcestfiletbasetlRtlibfileR:((s,/sys/lib/python2.7/distutils/bcppcompiler.pytlink�s|
$
!
c Cs�|r-|d}|d|d||f}n|d|f}xW|D]K}xB|D]:}tjj||j|��}tjj|�rQ|SqQWqDWdSdS(Nt_dt_bcpp(R#R$ROR?texistsR( RtdirsRR/tdlibt try_namestdirtnameRk((s,/sys/lib/python2.7/distutils/bcppcompiler.pyRV4s
RcCs|dkrd}ng}x�D]�tjjtjj|��\}}||jddgkr{td||f�n|r�tjj|�}n|dkr�|jtjj |||��q"|dkr�jtjj ||d��q"|jtjj |||j
��q"W|S(NRs.rcs.ress"unknown file type '%s' (from '%s')(RR#R$RRRUtsrc_extensionsRtbasenameR ROt
obj_extension(Rtsource_filenamest strip_dirR,t obj_namestsrc_nameRiR9((s,/sys/lib/python2.7/distutils/bcppcompiler.pytobject_filenamesNs$
$##cCs|jd||�\}}}t||�}dg|} |dk rZ| jd|�n|rm|| d*n|r�| j|�n| j|�|js�|dks�t||�r|r�|jtj j
|��ny|j| �Wqtk
r
}
|
GHt
|
�qXndS(Ns cpp32.exes-oi(t_fix_compile_argsRRR R!RRR&R#R$R'R(RR(Rtsourcetoutput_fileR-R.R0R1t_R4tpp_argsR:((s,/sys/lib/python2.7/distutils/bcppcompiler.pyt
preprocessjs$
$N(t__name__t
__module__t__doc__t
compiler_typetexecutablesR)R*RuRwtstatic_lib_extensiontshared_lib_extensiontstatic_lib_formattshared_lib_formatt
exe_extensionRRR=RERlRVR|R�(((s,/sys/lib/python2.7/distutils/bcppcompiler.pyR
sJ
B|(R�t__revision__R#tdistutils.errorsRRRRRtdistutils.ccompilerRRtdistutils.file_utilRtdistutils.dep_utilRt distutilsR R
(((s,/sys/lib/python2.7/distutils/bcppcompiler.pyt<module>s (
|