��Qc@s�dZdZddlZddlZddlZddlmZmZddlm Z ddl
mZddlm
Z
mZmZddlmZmZmZmZdd lmZejd
kr�ddlZnde
fd��YZdS(
s9distutils.unixccompiler
Contains the UnixCCompiler class, a subclass of CCompiler that handles
the "typical" Unix-style command-line C compiler:
* macros defined with -Dname[=value]
* macros undefined with -Uname
* include search directories specified with -Idir
* libraries specified with -lllib
* library search directories specified with -Ldir
* compile handled by 'cc' (or similar) executable with -c option:
compiles .c to .o
* link static library handled by 'ar' command (possibly with 'ranlib')
* link shared library handled by 'cc -shared'
s$Id$i�N(t
StringTypetNoneType(t sysconfig(tnewer(t CCompilertgen_preprocess_optionstgen_lib_options(tDistutilsExecErrortCompileErrortLibErrort LinkError(tlogtdarwint
UnixCCompilercBsgeZdZid&d6dgd6dgd6dgd6ddgd6dgd6d d
gd6d&d6Zejd
dkr�dged<nddddddgZdZdZ dZ
dZdZZ
Zejdkr�dZnd&d&d&d&d&d�Zd�Zd&dd&d�Zd&d&d&d&d&dd&d&d&d&d �Zd!�Zd"�Zd#�Zd$�Zdd%�ZRS('tunixtpreprocessortcctcompilertcompiler_sotcompiler_cxxs-sharedt linker_sot
linker_exetars-crtarchivertranlibiRs.cs.Cs.ccs.cxxs.cpps.ms.os.as.sos.dylibslib%s%stcygwins.execCs |jd||�\}}}t||�}|j|} |rV| jd|g�n|ri|| d*n|r| j|�n| j|�|js�|dks�t||�r|r�|jt j
j|��ny|j| �Wqt
k
r}
t|
�qXndS(Ns-oi(t_fix_compile_argstNoneRRtextendtappendtforceRtmkpathtostpathtdirnametspawnRR(tselftsourcetoutput_filetmacrostinclude_dirst
extra_preargstextra_postargstignoretpp_optstpp_argstmsg((sJ/usr/jas/src/cmd/cpython/dist/sys/lib/python2.7/distutils/unixccompiler.pyt
preprocessVs"
$c Csz|j}tjdkr1tj|||�}ny&|j|||d|g|�Wntk
ru}t|�nXdS(NRs-o(Rtsystplatformt_osx_supporttcompiler_fixupR#RR( R$tobjtsrctexttcc_argsR*R,RR.((sJ/usr/jas/src/cmd/cpython/dist/sys/lib/python2.7/distutils/unixccompiler.pyt_compileqs icCs�|j||�\}}|j|d|�}|j||�r�|jtjj|��|j|j|g||j �|j
r�y|j|j
|g�Wq�tk
r�}t|�q�Xq�nt
jd|�dS(Nt
output_dirsskipping %s (up-to-date)(t_fix_object_argstlibrary_filenamet
_need_linkRR R!R"R#RtobjectsRRR Rtdebug(R$R=toutput_libnameR9R>ttarget_langtoutput_filenameR.((sJ/usr/jas/src/cmd/cpython/dist/sys/lib/python2.7/distutils/unixccompiler.pytcreate_static_lib|s cCs"|j||�\}}|j|||�\}}}t||||�}t|�ttfkrotd�n|dk r�tj j
||�}n|j||�r||j|d|g}| r�dg|d*n|
r�
|d*n|r�j
|�n|jtj j|��y�|tjkr7|j}n
|j}|
dkr�|jr�d}tj j|d�dkr�d}x!d||kr�|d}q�Wn|j|||<ntjd kr�tj||�}n|j||�Wqtk
r
}t|�qXntjd
|�dS(Ns%'output_dir' must be a string or Nones-os-gisc++tenvit=Rsskipping %s (up-to-date)(R:t
_fix_lib_argsRttypeRRt TypeErrorRR R!tjoinR<R=RRR"Rt
EXECUTABLERRRtbasenameR0R1R2R3R#RR
RR>(R$ttarget_descR=RAR9t librariestlibrary_dirstruntime_library_dirstexport_symbolsR>R)R*t
build_tempR@tlib_optstld_argstlinkertiR.((sJ/usr/jas/src/cmd/cpython/dist/sys/lib/python2.7/distutils/unixccompiler.pytlink�sD
cCsd|S(Ns-L((R$tdir((sJ/usr/jas/src/cmd/cpython/dist/sys/lib/python2.7/distutils/unixccompiler.pytlibrary_dir_option�scCsd|kpd|kS(Ntgccsg++((R$t
compiler_name((sJ/usr/jas/src/cmd/cpython/dist/sys/lib/python2.7/distutils/unixccompiler.pyt_is_gcc�scCs�tjjtjd��}tjd dkr6d|Stjd dkrt|j|�rfdd|gSdd|gStjd d
ks�tjd dkr�d|gS|j|�r�d
|Sd|SdS(NtCCiRs-Lishp-uxs-Wl,+ss+sitirix646tosf1V5s-rpaths-Wl,-Rs-R(R R!RJRtget_config_varR0R1RZ(R$RVR((sJ/usr/jas/src/cmd/cpython/dist/sys/lib/python2.7/distutils/unixccompiler.pytruntime_library_dir_option�s
&
cCsd|S(Ns-l((R$tlib((sJ/usr/jas/src/cmd/cpython/dist/sys/lib/python2.7/distutils/unixccompiler.pytlibrary_option�scCs�|j|dd�}|j|dd�}|j|dd�}tjdkr�tjd�}tjd|�}|dkr�d} q�|jd �} nx#|D]}
t j
j|
|�}t j
j|
|�}t j
j|
|�}
tjdkrv|
jd
�s|
jd�rv|
jd�rvt j
j| |
d |�}t j
j| |
d |�}t j
j| |
d |�}
nt j
j
|�r�|St j
j
|�r�|St j
j
|
�r�|
Sq�WdS(
Ntlib_typetsharedtdylibtstaticRtCFLAGSs-isysroot\s+(\S+)t/is/System/s/usr/s/usr/local/(R;R0R1RR^tretsearchRtgroupR R!RHt
startswithtexists(R$tdirsR`R>tshared_ftdylib_ftstatic_ftcflagstmtsysrootRVRcRdRe((sJ/usr/jas/src/cmd/cpython/dist/sys/lib/python2.7/distutils/unixccompiler.pytfind_library_file�s4
N(t__name__t
__module__t
compiler_typeRtexecutablesR0R1tsrc_extensionst
obj_extensiontstatic_lib_extensiontshared_lib_extensiontdylib_lib_extensiontstatic_lib_formattshared_lib_formattdylib_lib_formatt
exe_extensionR/R8RBRURWRZR_RaRt(((sJ/usr/jas/src/cmd/cpython/dist/sys/lib/python2.7/distutils/unixccompiler.pyR
0s@
6 (t__doc__t__revision__R R0RhttypesRRt distutilsRtdistutils.dep_utilRtdistutils.ccompilerRRRtdistutils.errorsRRR R
RR1R2R
(((sJ/usr/jas/src/cmd/cpython/dist/sys/lib/python2.7/distutils/unixccompiler.pyt<module>s$"
|