��
���Lc@s"dZdZddkZddkZddkZddklZlZlZl Z l
Z
ddklZl
Z
lZddklZdZy@ddkZdZeZeiZeiZeiZeiZWn�ej
ovyLddkZddkZdZeZeiZeiZeiZeiZWn ej
oeid �nXnXeo"ei ei!ei"ei#fZ$nd
�Z%d�Z&d�Z'd
fd��YZ(d�Z)d�Z*d�Z+defd��YZ,e)�djo7ei-d�e,Z.ddk/l,Z,ddk/l(Z(ndS(s�distutils.msvccompiler
Contains MSVCCompiler, an implementation of the abstract CCompiler class
for the Microsoft Visual Studio.
s>$Id: msvccompiler.py 62197 2008-04-07 01:53:39Z mark.hammond $i����N(tDistutilsExecErrortDistutilsPlatformErrortCompileErrortLibErrort LinkError(t CCompilertgen_preprocess_optionstgen_lib_options(tlogiis�Warning: Can't read registry to find the necessary compiler setting
Make sure that Python modules _winreg, win32api or win32con are installed.c Cs�yt||�}Wntj
odSXg}d}xDyt||�}Wntj
oPnX|i|�|d}q9|S(sReturn list of registry keys.iiN(tRegOpenKeyExtRegErrortNonet
RegEnumKeytappend(tbasetkeythandletLtitk((s,/usr/lib/python2.6/distutils/msvccompiler.pyt read_keys<s
c
Cs�yt||�}Wntj
odSXh}d}xbyt||�\}}}Wntj
oPnX|i�}t|�|t|�<|d}q9|S(sXReturn dict of registry keys and values.
All names are converted to lowercase.
iiN(R R
RtRegEnumValuetlowertconvert_mbcs(RRRtdRtnametvaluettype((s,/usr/lib/python2.6/distutils/msvccompiler.pytread_valuesNs
cCsMt|dd�}|dj o*y|d�}WqItj
oqIXn|S(Ntencodetmbcs(tgetattrRtUnicodeError(tstenc((s,/usr/lib/python2.6/distutils/msvccompiler.pyRcs
t
MacroExpandercBs,eZd�Zd�Zd�Zd�ZRS(cCsh|_|i|�dS(N(tmacrostload_macros(tselftversion((s,/usr/lib/python2.6/distutils/msvccompiler.pyt__init__ns cCsEx>tD]6}t||�}|o|||id|<PqqWdS(Ns$(%s)(tHKEYSRR$(R&tmacrotpathRRR((s,/usr/lib/python2.6/distutils/msvccompiler.pyt set_macrorsc
Cs-d|}|id|dd�|id|dd�d}|id|d �y;|d
jo|id|d�n|id|d
�Wntj
o}td�nXd}xstD]k}yt||�}Wntj
o
q�nXt|d�}t|d||f�} | d|id<q�WdS(Ns%Software\Microsoft\VisualStudio\%0.1ftVCInstallDirs \Setup\VCt
productdirtVSInstallDirs \Setup\VSs Software\Microsoft\.NETFrameworktFrameworkDirtinstallrootg@tFrameworkSDKDirssdkinstallrootv1.1tsdkinstallrootsPython was built with Visual Studio 2003;
extensions must be built with a compiler than can generate compatible binaries.
Visual Studio 2003 was not found on this system. If you have Cygwin installed,
you can try compiling with MingW32, by passing "-c mingw32" to setup.py.s.Software\Microsoft\NET Framework Setup\Productis%s\%sR's$(FrameworkVersion)( R,tKeyErrorRR)R R
RRR$(
R&R'tvsbasetnettexctpRthRR((s,/usr/lib/python2.6/distutils/msvccompiler.pyR%ys,
cCs9x2|ii�D]!\}}ti|||�}qW|S(N(R$titemststringtreplace(R&R!Rtv((s,/usr/lib/python2.6/distutils/msvccompiler.pytsub�s(t__name__t
__module__R(R,R%R>(((s,/usr/lib/python2.6/distutils/msvccompiler.pyR#ls cCs�d}titi|�}|djodS|t|�}ti|idd�\}}t|d �d}t|dd!�d }|djo
d
}n|djo ||SdS(s�Return the version of MSVC that was used to build Python.
For Python 2.3 and up, the version number is included in
sys.version. For earlier versions, assume the compiler is MSVC 6.
sMSC v.i����it ii����iig$@iN(R;tfindtsysR'tlentsplittintR(tprefixRR!tresttmajorVersiontminorVersion((s,/usr/lib/python2.6/distutils/msvccompiler.pytget_build_version�s
cCs]d}titi|�}|djodStitid|�}ti|t|�|!S(saReturn the processor architecture.
Possible results are "Intel", "Itanium", or "AMD64".
s bit (i����tIntelt)(R;RBRCR'RD(RGRtj((s,/usr/lib/python2.6/distutils/msvccompiler.pytget_build_architecture�s
cCsKg}x>|D]6}tii|�}||jo|i|�q
q
W|S(snReturn a list of normalized paths with duplicates removed.
The current order of paths is maintained.
(tosR+tnormpathR
(tpathst
reduced_pathsR8tnp((s,/usr/lib/python2.6/distutils/msvccompiler.pytnormalize_and_reduce_paths�s
tMSVCCompilercBsDeZdZdZhZdgZdddgZdgZdgZeeeeZ dZ
d Zd
ZdZ
dZZd
Zdddd�Zd�Zddd�Zdddddddd�Zdddd�Zddddddddddd�
Zd�Zd�Zd�Zdd�Zd�Zdd�Zd�ZRS(swConcrete class that implements an interface to Microsoft Visual C++,
as defined by the CCompiler abstract class.tmsvcs.cs.ccs.cpps.cxxs.rcs.mcs.ress.objs.libs.dlls%s%ss.exeicCs�ti||||�t�|_t�|_|idjoL|idjod|_t|i�|_n
d|_d|i|_ nd|id|_ t
|_dS(NRLisSoftware\Microsoft\VisualStudiosSoftware\Microsoft\DevstudiosVisual Studio version %ssMicrosoft SDK compiler %si(RR(RKt_MSVCCompiler__versionROt_MSVCCompiler__archt_MSVCCompiler__rootR#t_MSVCCompiler__macrost_MSVCCompiler__producttFalsetinitialized(R&tverbosetdry_runtforce((s,/usr/lib/python2.6/distutils/msvccompiler.pyR(�s cCs�g|_dtijoQdtijoA|id�o1d|_d|_d|_d|_d|_n�|i d�|_t
|i�d jotd
|i�n|id�|_|id�|_|id�|_|id�|_|id�|_|i
d�|i
d�y8x1titidd
�D]}|ii|�q7WWntj
onXt|i�|_ti|id
�tid<d|_|idjo=ddddddg|_dddddddg|_n:ddddddg|_dddddddg|_dddg|_|idjoddddg|_ndddddg|_dg|_t|_dS( NtDISTUTILS_USE_SDKtMSSdkscl.exeslink.exeslib.exesrc.exesmc.exeR+isxPython was built with %s, and extensions need to be built with the same version of the compiler, but it isn't installed.tlibtincludet;RLs/nologos/Oxs/MDs/W3s/GXs/DNDEBUGs/Ods/MDds/Z7s/D_DEBUGs/GS-s/DLLs/INCREMENTAL:NOis/INCREMENTAL:nos/DEBUGs /pdb:None(t_MSVCCompiler__pathsRPtenvirontfind_exetcctlinkerRdtrctmctget_msvc_pathsRDRR\tset_path_env_varR;RER
R4RUtjoinRtpreprocess_optionsRYtcompile_optionstcompile_options_debugtldflags_sharedRXtldflags_shared_debugtldflags_statictTrueR^(R&R8((s,/usr/lib/python2.6/distutils/msvccompiler.pyt
initialize�sV 0
tcCsH|djo
d}ng}x$|D]}tii|�\}}tii|�d}|tii|�}||ijotd|��n|otii|�}n||i jo'|i
tii|||i��q$||i
jo'|i
tii|||i��q$|i
tii|||i��q$W|S(NRyisDon't know how to compile %s(RRPR+tsplitextt
splitdrivetisabstsrc_extensionsRtbasenamet_rc_extensionsR
Rpt
res_extensiont_mc_extensionst
obj_extension(R&tsource_filenamest strip_dirt
output_dirt obj_namestsrc_nameRtext((s,/usr/lib/python2.6/distutils/msvccompiler.pytobject_filenames=s*
c
Cs�|ip|i�n|i||||||�\}} }}
}|pg}|id�|o|i|i�n|i|i�x_| D]W}
y||
\}}Wntj
o
q�nX|oti i
|�}n||ijod|}n�||ijod|}nt||i
joa|}d|
}y)|i|ig|
|g|g�Wq�tj
o}t|�q�Xq�n||ijo�ti i|�}ti i|
�}y�|i|igd|d|g|g�ti iti i|��\}}ti i||d�}|i|igd|
g|g�Wq�tj
o}t|�q�Xq�ntd||
f��d |
}y-|i|ig||
||g|�Wq�tj
o}t|�q�Xq�W| S(
Ns/cs/Tcs/Tps/fos-hs-rs.rcs"Don't know how to compile %s to %ss/Fo(R^Rxt_setup_compileR
textendRsRrR4RPR+tabspatht
_c_extensionst_cpp_extensionsRtspawnRlRRR�tdirnameRmRzR~RpRj(R&tsourcesR�R$tinclude_dirstdebugt
extra_preargstextra_postargstdependstobjectstpp_optstbuildtcompile_optstobjtsrcR�t input_optt
output_opttmsgth_dirtrc_dirRt_trc_file((s,/usr/lib/python2.6/distutils/msvccompiler.pytcompile^sl
#$$#
c Cs�|ip|i�n|i||�\}}|i|d|�}|i||�o\|d|g}|ony|i|ig|�Wq�tj
o}t|�q�Xnt i
d|�dS(NR�s/OUT:sskipping %s (up-to-date)(R^Rxt_fix_object_argstlibrary_filenamet
_need_linkR�RdRRRR�( R&R�toutput_libnameR�R�ttarget_langtoutput_filenametlib_argsR�((s,/usr/lib/python2.6/distutils/msvccompiler.pytcreate_static_lib�s
c Csn|ip|i�n|i||�\}}|i|||�\}}}|o|idt|��nt||||�}|dj oti i
||�}n|i||�o�|ti
jo)| o|id}q|id}n| o
|i}n
|i}g}x&|pgD]}|id|�q(W||||d|g}|dj ogti iti i|��\}}ti i
ti i|d�|i|��}|id|�n|
o|
|d*n|o|i|�n|iti i|��y|i|ig|�Wqjtj
o}t|�qjXntid|�dS(Ns5I don't know what to do with 'runtime_library_dirs': is/EXPORT:s/OUT:is/IMPLIB:sskipping %s (up-to-date)(R^RxR�t
_fix_lib_argstwarntstrRRRPR+RpR�Rt
EXECUTABLERuRtR
RzR~R�R�R�tmkpathR�RkRRRR�(R&ttarget_descR�R�R�t librariestlibrary_dirstruntime_library_dirstexport_symbolsR�R�R�t
build_tempR�tlib_optstldflagstexport_optstsymtld_argstdll_nametdll_exttimplib_fileR�((s,/usr/lib/python2.6/distutils/msvccompiler.pytlink�sT
cCsd|S(Ns /LIBPATH:((R&tdir((s,/usr/lib/python2.6/distutils/msvccompiler.pytlibrary_dir_option%scCs
td�dS(Ns<don't know how to set runtime library search path for MSVC++(R(R&R�((s,/usr/lib/python2.6/distutils/msvccompiler.pytruntime_library_dir_option(scCs
|i|�S(N(R�(R&Rd((s,/usr/lib/python2.6/distutils/msvccompiler.pytlibrary_option,scCs�|o|d|g}n
|g}xY|D]M}xD|D]<}tii||i|��}tii|�o|Sq8Wq+WdSdS(Nt_d(RPR+RpR�texistsR(R&tdirsRdR�t try_namesR�Rtlibfile((s,/usr/lib/python2.6/distutils/msvccompiler.pytfind_library_file0s
cCs�xJ|iD]?}tiitii|�|�}tii|�o|Sq
WxZtitidd�D]?}tiitii|�|�}tii|�o|SqgW|S(s�Return path to an MSVC executable program.
Tries to find the program in several places: first, one of the
MSVC program search paths from the registry; next, the directories
in the PATH environment variable. If any of those work, return an
absolute path that is known to exist. If none of them work, just
return the original program name, 'exe'.
tPathRf( RgRPR+RpR�tisfileR;RERh(R&texeR8tfn((s,/usr/lib/python2.6/distutils/msvccompiler.pyRiDs
! ! tx86cCstpgS|d}|idjod|i|if}nd|i|f}xmtD]e}t||�}|oI|idjo!ti|ii||�d�Sti||d�SqZqZW|idjoDxAtD]5}t|d|i�d j o|i
d�Pq�q�WngS(
s�Get a list of devstudio directories (include, lib or path).
Return a list of strings. The list will be empty if unable to
access the registry or appropriate registry keys not found.
s dirsis6%s\%0.1f\VC\VC_OBJECTS_PLATFORM_INFO\Win32\Directoriess?%s\6.0\Build System\Components\Platforms\Win32 (%s)\DirectoriesRfis%s\6.0s�It seems you have Visual Studio 6 installed, but the expected registry settings are not present.
You must at least run the Visual Studio GUI once so that these entries are created.N(t
_can_read_regRXRZR)RR;RER[R>RR�(R&R+tplatformRRR((s,/usr/lib/python2.6/distutils/msvccompiler.pyRn[s,
!
cCsW|djo|id�}n|i|�}|oti|d�ti|<ndS(s�Set environment variable 'name' to an MSVC path type value.
This is equivalent to a SET command prior to execution of spawned
commands.
RdtlibraryRfN(RnR;RpRPRh(R&RR8((s,/usr/lib/python2.6/distutils/msvccompiler.pyRo�s
N(R?R@t__doc__t
compiler_typetexecutablesR�R�RR�R}R�R�tstatic_lib_extensiontshared_lib_extensiontstatic_lib_formattshared_lib_formatt
exe_extensionR(RxR�RR�R�R�R�R�R�R�RiRnRo(((s,/usr/lib/python2.6/distutils/msvccompiler.pyRV�sP
BZG %g @s3Importing new compiler from distutils.msvc9compiler(RV(R#(0R�t__revision__RCRPR;tdistutils.errorsRRRRRtdistutils.ccompilerRRRt distutilsRR�t_winregthkey_modt OpenKeyExR tEnumKeyRt EnumValueRterrorR
tImportErrortwin32apitwin32continfot
HKEY_USERStHKEY_CURRENT_USERtHKEY_LOCAL_MACHINEtHKEY_CLASSES_ROOTR)RRRR#RKRORURVR�tOldMSVCCompilertdistutils.msvc9compiler(((s,/usr/lib/python2.6/distutils/msvccompiler.pyt<module>s\$(
.
��