a „oe\ã @s”dZddlZddlZddlZddlmZmZmZmZm Z ddl m Z m Z ddl mZdZz,ddlZdZeZejZejZejZejZWndeyèz4ddlZddlZdZeZejZejZejZejZWneyâe d ¡Yn0Yn0erejejej ej!fZ"e #d e$¡d d „Z%d d„Z&dd„Z'Gdd„dƒZ(dd„Z)dd„Z*dd„Z+Gdd„de ƒZ,e)ƒdkre -d¡e,Z.ddl/m,Z,ddl/m(Z(dS)z‚distutils.msvccompiler Contains MSVCCompiler, an implementation of the abstract CCompiler class for the Microsoft Visual Studio. éNé)ÚDistutilsExecErrorÚDistutilsPlatformErrorÚ CompileErrorÚLibErrorÚ LinkError)Ú CCompilerÚgen_lib_options)ÚlogFTzWarning: Can't read registry to find the necessary compiler setting Make sure that Python modules winreg, win32api or win32con are installed.z˜msvccompiler is deprecated and slated to be removed in the future. Please discontinue use or file an issue with pypa/distutils describing your use case.cCsjzt||ƒ}Wnty"YdS0g}d}zt||ƒ}WntyPYqfYn0| |¡|d7}q,|S)zReturn list of registry keys.Nrr)Ú RegOpenKeyExÚRegErrorÚ RegEnumKeyÚappend)ÚbaseÚkeyÚhandleÚLÚiÚk©rúCC:\Program Files\Certbot\pkgs\setuptools\_distutils\msvccompiler.pyÚ read_keysJs     rcCs~zt||ƒ}Wnty"YdS0i}d}zt||ƒ\}}}WntyVYqzYn0| ¡}t|ƒ|t|ƒ<|d7}q,|S)zXReturn dict of registry keys and values. All names are converted to lowercase. Nrr)r r Ú RegEnumValueÚlowerÚ convert_mbcs)rrrÚdrÚnameÚvalueÚtyperrrÚ read_values\s    rcCs8t|ddƒ}|dur4z |dƒ}Wnty2Yn0|S)NÚdecodeÚmbcs)ÚgetattrÚ UnicodeError)ÚsZdecrrrrrs   rc@s,eZdZdd„Zdd„Zdd„Zdd„Zd S) Ú MacroExpandercCsi|_| |¡dS©N)ÚmacrosÚ load_macros)ÚselfÚversionrrrÚ__init__}szMacroExpander.__init__cCs2tD](}t||ƒ}|r|||jd|<q.qdS)Nz$(%s))ÚHKEYSrr')r)ZmacroÚpathrrrrrrÚ set_macros  zMacroExpander.set_macroc Csæd|}| d|dd¡| d|dd¡d}| d|d ¡z*|d krX| d |d ¡n| d |d ¡Wnty‚tdƒ‚Yn0d}tD]T}zt||ƒ}Wnty´YqŒYn0t|dƒ}t|d ||¡ƒ}|d|j d<qŒdS)Nz%Software\Microsoft\VisualStudio\%0.1fZ VCInstallDirz \Setup\VCZ productdirZ VSInstallDirz \Setup\VSz Software\Microsoft\.NETFrameworkZ FrameworkDirZ installrootg@ZFrameworkSDKDirzsdkinstallrootv1.1ZsdkinstallrootaPython 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.z.Software\Microsoft\NET Framework Setup\Productrz{}\{}r*z$(FrameworkVersion)) r.ÚKeyErrorrr,r r r rÚformatr') r)r*ZvsbaseZnetÚprÚhrrrrrr(ˆs, ÿ    zMacroExpander.load_macroscCs$|j ¡D]\}}| ||¡}q |Sr&)r'ÚitemsÚreplace)r)r$rÚvrrrÚsub¥szMacroExpander.subN)Ú__name__Ú __module__Ú __qualname__r+r.r(r6rrrrr%|sr%cCsšd}tj |¡}|dkrdS|t|ƒ}tj|d… dd¡\}}t|dd…ƒd}|dkrf|d7}t|d d …ƒd }|dkr†d }|dkr–||SdS) zÃ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. zMSC v.éÿÿÿÿéNú réþÿÿÿé éég$@r)Úsysr*ÚfindÚlenÚsplitÚint)Úprefixrr$ÚrestZ majorVersionZ minorVersionrrrÚget_build_version«s  rHcCs@d}tj |¡}|dkrdStj d|¡}tj|t|ƒ|…S)zUReturn the processor architecture. Possible results are "Intel" or "AMD64". z bit (r:ÚIntelú))rAr*rBrC)rFrÚjrrrÚget_build_architectureÅs  rLcCs0g}|D]"}tj |¡}||vr| |¡q|S)znReturn a list of normalized paths with duplicates removed. The current order of paths is maintained. )Úosr-Únormpathr)ÚpathsZ reduced_pathsr1ZnprrrÚnormalize_and_reduce_pathsÓs   rPc sÜeZdZdZdZiZdgZgd¢ZdgZdgZ eeee Z dZ dZ d Z d Zd ZZd Zd+‡fdd„ Zdd„Zd,dd„Zd-dd„Zd.dd„Zd/dd„Zdd„Zdd„Zd d!„Zd0d"d#„Zd$d%„Zd1d'd(„Zd)d*„Z‡ZS)2Ú MSVCCompilerztConcrete class that implements an interface to Microsoft Visual C++, as defined by the CCompiler abstract class.Zmsvcz.c)z.ccz.cppz.cxxú.rcz.mcz.resz.objz.libz.dllz%s%sz.exercsvtƒ |||¡tƒ|_tƒ|_|jdkr\|jdkrHd|_t|jƒ|_nd|_d|j|_ nd|jd|_ d|_ dS) NrIézSoftware\Microsoft\VisualStudiozSoftware\Microsoft\DevstudiozVisual Studio version %szMicrosoft SDK compiler %sr;F) Úsuperr+rHÚ_MSVCCompiler__versionrLÚ_MSVCCompiler__archÚ_MSVCCompiler__rootr%Ú_MSVCCompiler__macrosÚ_MSVCCompiler__productÚ initialized)r)ÚverboseÚdry_runÚforce©Ú __class__rrr+ÿs  zMSVCCompiler.__init__cCsŽg|_dtjvrDdtjvrD| d¡rDd|_d|_d|_d|_d|_nx|  d¡|_t |jƒd krlt d |j ƒ‚| d¡|_| d¡|_| d¡|_| d¡|_| d¡|_|  d ¡|  d ¡z&tjd d ¡D]}|j |¡qÎWntyôYn0t|jƒ|_d  |j¡tjd<d|_|jdkr|jdkrt|j ||¡ d¡S|| d¡Sq>|jdkr¾tD]&}t|d|jƒdur–|  d ¡q¾q–gS) zÐ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. z dirsrSz8{}\{:0.1f}\VC\VC_OBJECTS_PLATFORM_INFO\Win32\Directoriesz?%s\6.0\Build System\Components\Platforms\Win32 (%s)\Directoriesrar;z%s\6.0Nz´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.) Ú _can_read_regrUr0rWr,rrXr6rDr¤)r)r-Úplatformrrrrrrrwus4 þÿÿ   ÿzMSVCCompiler.get_msvc_pathscCs6|dkr| d¡}n | |¡}|r2d |¡tj|<dS)z¡Set environment variable 'name' to an MSVC path type value. This is equivalent to a SET command prior to execution of spawned commands. r`ZlibraryraN)rwryrMrq)r)rr1rrrrxŸs   zMSVCCompiler.set_path_env_var)rrr)rr)NNNrNNN)NrN) NNNNNrNNNN)r)r²) r7r8r9Ú__doc__Z compiler_typeZ executablesrŽrr…r‡rƒr†rˆZstatic_lib_extensionZshared_lib_extensionZstatic_lib_formatZshared_lib_formatZ exe_extensionr+r~r‹r›r£r¦r©rªr«r®rrrwrxÚ __classcell__rrr^rrQâsZS ÷ _ÿ ò T  *rQg @z3Importing new compiler from distutils.msvc9compiler)rQ)r%)0rµrArMÚwarningsÚerrorsrrrrrZ ccompilerrr Z_logr r³ÚwinregZhkey_modÚ OpenKeyExr ÚEnumKeyr Ú EnumValuerÚerrorr Ú ImportErrorZwin32apiZwin32conÚinfoÚ HKEY_USERSÚHKEY_CURRENT_USERÚHKEY_LOCAL_MACHINEÚHKEY_CLASSES_ROOTr,r¤ÚDeprecationWarningrrrr%rHrLrPrQr’ZOldMSVCCompilerZdistutils.msvc9compilerrrrrÚsp      ÿ üü /O