m &UIc@sdZdZdkZdkZdkZdklZlZlZl Z l Z dk l Z l Z lZdklZdZy=dkZdZeZeiZeiZeiZeiZWn|ej opyFdkZdkZdZeZeiZeiZeiZeiZWq4ej oeidq4XnXeo"ei ei!ei"ei#fZ$nd Z%d Z&d Z'd fd YZ(dZ)de fdYZ*dS(sdistutils.msvccompiler Contains MSVCCompiler, an implementation of the abstract CCompiler class for the Microsoft Visual Studio. sA$Id: msvccompiler.py 50980 2006-07-30 13:31:20Z martin.v.loewis $N(sDistutilsExecErrorsDistutilsPlatformErrors CompileErrorsLibErrors LinkError(s CCompilersgen_preprocess_optionssgen_lib_options(slogiisWarning: Can't read registry to find the necessary compiler setting Make sure that Python modules _winreg, win32api or win32con are installed.cCsyt||}Wntj o dSnXg}d}xFyt||}Wntj oPnX|i ||d}q<W|S(sReturn list of registry keys.iiN( t RegOpenKeyExtbasetkeythandletRegErrortNonetLtit RegEnumKeytktappend(RRRRR R((t3/data/zmath/lib/python2.4/distutils/msvccompiler.pyt read_keys<s   cCsyt||}Wntj o dSnXh}d}xdyt||\}}}Wntj oPnX|i }t ||t |<|d}q<W|S(sXReturn dict of registry keys and values. All names are converted to lowercase. iiN(RRRRRRtdRt RegEnumValuetnametvaluettypetlowert convert_mbcs(RRRR RRRR((R t read_valuesNs"  cCsMt|dd}|dj o*y|d}WqItj oqIXn|S(Ntencodetmbcs(tgetattrtsRtenct UnicodeError(RR((R Rcs  t MacroExpandercBs,tZdZdZdZdZRS(NcCsh|_|i|dS(N(tselftmacrost load_macrostversion(RR((R t__init__ns cCsEx>tD]6}t||}|o|||id|R0RKtfind_exetcctlinkerRPtrctmctset_path_env_varR5R?tostenvironR1R R.tjoinRtpreprocess_optionstcompile_optionstcompile_options_debugtldflags_sharedtldflags_shared_debugtldflags_statictTrueRO(RR1((R t initializes4    tcCsH|djo d}ng}x$|D]}tii|\}}tii |d}|tii |}||i jotd|n|otii|}n||ijo'|itii|||iq$||ijo'|itii|||iq$|itii|||iq$W|S(NRfisDon't know how to compile %s(t output_dirRt obj_namestsource_filenamestsrc_nameR[R"tsplitextRtextt splitdrivetisabsRtsrc_extensionst CompileErrort strip_dirtbasenamet_rc_extensionsR R]t res_extensiont_mc_extensionst obj_extension(RRiRqRgRhRlRRj((R tobject_filenames s* c Cs|ip|in|i||||||\}}}} } |pg} | id|o| i|in| i|ix_|D]W}y| |\}}Wntj o qnX|otii|}n||ijod|}n||ijod|}nt||ijoa|}d|}y)|i |i!g| |g|gWqt"j o}t$|qXqn||i%jotii&|} tii&|}y|i |i)gd| d|g|gtii*tii+|\}}tii.||d} |i |i!gd|g| gWqt"j o}t$|qXqnt$d||fd |}y-|i |i0g| | ||g|Wqt"j o}t$|qXqW|S( Ns/cs/Tcs/Tps/fos-hs-rs.rcs"Don't know how to compile %s to %ss/Fo(1RRORet_setup_compileRgRt include_dirstsourcestdependstextra_postargstobjectstpp_optstbuildt extra_preargst compile_optsR tdebugtextendR`R_tobjtsrcRlR.R[R"tabspatht _c_extensionst input_optt_cpp_extensionsRst output_opttspawnRXtDistutilsExecErrortmsgRpRutdirnameth_dirtrc_dirRYRkRrRt_R]trc_fileRV(RRzRgRRyRRR|R{R~RRRRRR}RRRRRlRRR((R tcompile*s^    )*$) -c Cs|ip|in|i||\}}|i|d|}|i ||o\|d|g}|ony|i |i g|Wqtj o}t|qXnti d|dS(NRgs/OUT:sskipping %s (up-to-date)(RRORet_fix_object_argsR}Rgtlibrary_filenametoutput_libnametoutput_filenamet _need_linktlib_argsRRRPRRtLibErrortlog( RR}RRgRt target_langRRR((R tcreate_static_libs cCsn|ip|in|i||\}}|i|||\}}}|o|i dt |nt ||||}|dj otii||}n|i||o|tijo)| o|id}q|id}n| o |i}n |i}g}x&|pgD]}|id|q(W||||d|g}|dj ogtii tii!|\}}tiitii$|d|i%|}|id|n| o| |d*n| o|i)| n|i*tii$|y|i+|i,g|Wqjt-j o}t/|qjXnt0id|dS(Ns5I don't know what to do with 'runtime_library_dirs': is/EXPORT:s/OUT:is/IMPLIB:sskipping %s (up-to-date)(1RROReRR}Rgt _fix_lib_argst librariest library_dirstruntime_library_dirstwarntstrtgen_lib_optionstlib_optsRR[R"R]RRt target_descRGt EXECUTABLERRbtldflagsRat export_optstexport_symbolstsymR tld_argsRkRrtdll_nametdll_extRRt implib_fileRR|RtmkpathRRWRRt LinkErrorR(RRR}RRgRRRRRRR|t build_tempRRRRRRRRRR((R tlinksN      $cCsd|S(Ns /LIBPATH:(tdir(RR((R tlibrary_dir_optionscCs tddS(Ns<don't know how to set runtime library search path for MSVC++(R0(RR((R truntime_library_dir_optionscCs |i|S(N(RRRP(RRP((R tlibrary_optionscCs|o|d|g}n |g}x\|D]P}xG|D]?}tii||i |}tii |o|Sq8q8Wq+WdSdS(Nt_d(RRPt try_namestdirsRRR[R"R]RRtlibfiletexistsR(RRRPRRRRR((R tfind_library_files cCsxM|iD]B}tiitii||}tii |o|Sq q Wx]t i ti ddD]B}tiitii||}tii |o|SqjqjW|S(sReturn 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'. tPathRRN( RRTR1R[R"R]RtexetfntisfileR5R?R\(RRR1R((R RUs ! ! tx86cCs!tpgSn|d}|idjod|i|if}nd|i|f}xptD]h}t ||}|oL|idjo$t i |i i||dSqt i ||dSq]q]W|idjoDxAtD]5}t |d|id j o|idPqqWngS( sGet 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)\DirectoriesRRis%s\6.0sIt 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_regR"RRKRLRtplatformR!RRR R5R?RMR7RR(RR"RR RR((R RS's* $  cCsW|djo|id}n|i|}|oti|dti|