ó p®¸Qc@sdZdZddlZddlZddlZddlmZmZmZm Z m Z ddl m Z m Z ddlmZdZy@ddlZdZeZejZejZejZejZWn~ek rDyLddlZddlZdZeZejZejZejZejZWnek r@ejd ƒnXnXerlejej ej!ej"fZ#nd „Z$d „Z%d „Z&d fd„ƒYZ'd„Z(d„Z)d„Z*de fd„ƒYZ+e(ƒdkrej,dƒe+Z-ddl.m+Z+ddl.m'Z'ndS(s‚distutils.msvccompiler Contains MSVCCompiler, an implementation of the abstract CCompiler class for the Microsoft Visual Studio. s$Id$iÿÿÿÿN(tDistutilsExecErrortDistutilsPlatformErrort CompileErrortLibErrort LinkError(t CCompilertgen_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.cCs}yt||ƒ}Wntk r'dSXg}d}xByt||ƒ}Wntk r^PnX|j|ƒ|d}q7|S(sReturn list of registry keys.iiN(t RegOpenKeyExtRegErrortNonet RegEnumKeytappend(tbasetkeythandletLtitk((s,/sys/lib/python2.7/distutils/msvccompiler.pyt read_keys;s    cCs›yt||ƒ}Wntk r'dSXi}d}x`yt||ƒ\}}}Wntk rgPnX|jƒ}t|ƒ|t|ƒ<|d}q7|S(sXReturn dict of registry keys and values. All names are converted to lowercase. iiN(RR R t RegEnumValuetlowert convert_mbcs(R RRtdRtnametvaluettype((s,/sys/lib/python2.7/distutils/msvccompiler.pyt read_valuesMs    cCsIt|ddƒ}|dk rEy|dƒ}WqEtk rAqEXn|S(Ntencodetmbcs(tgetattrR t UnicodeError(tstenc((s,/sys/lib/python2.7/distutils/msvccompiler.pyRbs  t MacroExpandercBs,eZd„Zd„Zd„Zd„ZRS(cCsi|_|j|ƒdS(N(tmacrost load_macros(tselftversion((s,/sys/lib/python2.7/distutils/msvccompiler.pyt__init__ms cCsCx<tD]4}t||ƒ}|r|||jd||dkrd}ng}x|D]}tjj|ƒ\}}tjj|ƒd}|tjj|ƒ}||jkrŽtd|ƒ‚n|r©tjj|ƒ}n||j krÞ|j tjj |||j ƒƒq"||j kr|j tjj |||j ƒƒq"|j tjj |||jƒƒq"W|S(NRwisDon't know how to compile %s(R RNR*tsplitextt splitdrivetisabstsrc_extensionsRtbasenamet_rc_extensionsR Rnt res_extensiont_mc_extensionst obj_extension(R%tsource_filenamest strip_dirt output_dirt obj_namestsrc_nameR text((s,/sys/lib/python2.7/distutils/msvccompiler.pytobject_filenames<s(  c CsÙ|js|jƒn|j||||||ƒ\}} }} } |pLg} | jdƒ|ru| j|jƒn| j|jƒxM| D]E} y| | \}}Wntk r¼qŒnX|rØtj j |ƒ}n||j krôd|}n‡||j krd|}nk||j kr}|}d| }y)|j|jg| |g|gƒWqŒtk rv}t|‚qŒXqŒnþ||jkretj j|ƒ}tj j| ƒ}y|j|jgd|d|g|gƒtj jtj j|ƒƒ\}}tj j||dƒ}|j|jgd| g|gƒWqŒtk r^}t|‚qŒXqŒntd|| fƒ‚d | }y-|j|jg| | ||g|ƒWqŒtk rÐ}t|‚qŒXqŒW| S( Ns/cs/Tcs/Tps/fos-hs-rs.rcs"Don't know how to compile %s to %ss/Fo(R\Rvt_setup_compileR textendRqRpR3RNR*tabspatht _c_extensionst_cpp_extensionsR}tspawnRjRRRtdirnameRkRxR|RnRh(R%tsourcesRƒR#t include_dirstdebugt extra_preargstextra_postargstdependstobjectstpp_optstbuildt compile_optstobjtsrcR†t input_optt output_opttmsgth_dirtrc_dirR t_trc_file((s,/sys/lib/python2.7/distutils/msvccompiler.pytcompile]sj        # $$#   c CsÀ|js|jƒn|j||ƒ\}}|j|d|ƒ}|j||ƒr¬|d|g}|rony|j|jg|ƒWq¼tk r¨}t|‚q¼Xnt j d|ƒdS(NRƒs/OUT:sskipping %s (up-to-date)( R\Rvt_fix_object_argstlibrary_filenamet _need_linkRRbRRRR‘( R%R•toutput_libnameRƒR‘t target_langtoutput_filenametlib_argsR((s,/sys/lib/python2.7/distutils/msvccompiler.pytcreate_static_lib¶s cCsW|js|jƒn|j||ƒ\}}|j|||ƒ\}}}|rl|jdt|ƒƒnt||||ƒ}|dk r¥tj j ||ƒ}n|j ||ƒrC|t j krì| rÜ|jd}q|jd}n| rþ|j}n |j}g}x%|pgD]}|jd|ƒqW||||d|g}|dk rÄtj jtj j|ƒƒ\}}tj j tj j|dƒ|j|ƒƒ}|jd|ƒn| r×| |d*n| rí|j| ƒn|jtj j|ƒƒy|j|jg|ƒWqStk r?}t|‚qSXntjd|ƒdS(Ns5I don't know what to do with 'runtime_library_dirs': is/EXPORT:s/OUT:is/IMPLIB:sskipping %s (up-to-date)(R\RvR£t _fix_lib_argstwarntstrRR RNR*RnR¥Rt EXECUTABLERsRrR RxR|RŽR¤R‰tmkpathRRiRRRR‘(R%t target_descR•R¨Rƒt librariest library_dirstruntime_library_dirstexport_symbolsR‘R’R“t build_tempR§tlib_optstldflagst export_optstsymtld_argstdll_nametdll_extt implib_fileR((s,/sys/lib/python2.7/distutils/msvccompiler.pytlinkÐsR          cCsd|S(Ns /LIBPATH:((R%tdir((s,/sys/lib/python2.7/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,/sys/lib/python2.7/distutils/msvccompiler.pytruntime_library_dir_option'scCs |j|ƒS(N(R¤(R%Rb((s,/sys/lib/python2.7/distutils/msvccompiler.pytlibrary_option+scCs€|r|d|g}n |g}xW|D]K}xB|D]:}tjj||j|ƒƒ}tjj|ƒr6|Sq6Wq)WdSdS(Nt_d(RNR*RnR¤texistsR (R%tdirsRbR‘t try_namesR¿Rtlibfile((s,/sys/lib/python2.7/distutils/msvccompiler.pytfind_library_file/s    cCsªxH|jD]=}tjjtjj|ƒ|ƒ}tjj|ƒr |Sq WxXtjtjddƒD]=}tjjtjj|ƒ|ƒ}tjj|ƒre|SqeW|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'. tPathRd( ReRNR*RnRŠtisfileR9RCRf(R%texeR6tfn((s,/sys/lib/python2.7/distutils/msvccompiler.pyRgCs ! !tx86cCsts gS|d}|jdkr<d|j|jf}nd|j|f}xitD]a}t||ƒ}|rV|jdkr tj|jj||ƒdƒStj||dƒSqVqVW|jdkr x>tD]3}t|d|jƒd k rÑ|j 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)\DirectoriesRdis%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_regRVRXR(RR9RCRYR<R R¬(R%R*tplatformRR R((s,/sys/lib/python2.7/distutils/msvccompiler.pyRlZs(      cCsS|dkr|jdƒ}n|j|ƒ}|rOtj|dƒtj|t__doc__t compiler_typet executablesR‹RŒR}RR{R~R€tstatic_lib_extensiontshared_lib_extensiontstatic_lib_formattshared_lib_formatt exe_extensionR'RvR‡R R¢RªR¾RÀRÁRÂRÈRgRlRm(((s,/sys/lib/python2.7/distutils/msvccompiler.pyRTÌsP     B  Z  G      %g @s3Importing new compiler from distutils.msvc9compiler(RT(R"(/RÑt __revision__RARNR9tdistutils.errorsRRRRRtdistutils.ccompilerRRt distutilsRRÎt_winregthkey_modt OpenKeyExRtEnumKeyR t EnumValueRterrorR t ImportErrortwin32apitwin32continfot HKEY_USERStHKEY_CURRENT_USERtHKEY_LOCAL_MACHINEtHKEY_CLASSES_ROOTR(RRRR"RIRMRSRTR‘tOldMSVCCompilertdistutils.msvc9compiler(((s,/sys/lib/python2.7/distutils/msvccompiler.pyts`   (                 .  ÿà