a DOg[ @szddlZddlZddlmZmZmZmZmZddlm Z m Z ddl m Z dZ z,ddlZdZ eZejZejZejZejZWndeyz4ddlZddlZdZ eZejZejZejZejZWneye dYn0Yn0e rejejejejfZ dd Z!d d Z"d d Z#GdddZ$ddZ%ddZ&ddZ'Gddde Z(e%dkrve )de(Z*ddl+m(Z(ddl+m$Z$dS)N)DistutilsExecErrorDistutilsPlatformError CompileErrorLibError LinkError) CCompilergen_lib_options)logFTzWarning: Can't read registry to find the necessary compiler setting Make sure that Python modules winreg, win32api or win32con are installed.cCsjzt||}Wnty"YdS0g}d}zt||}WntyPYqfYn0|||d7}q,|SNr) RegOpenKeyExRegError RegEnumKeyappend)basekeyhandleLikr;/opt/alt/python39/lib64/python3.9/distutils/msvccompiler.py read_keys7s     rcCs~zt||}Wnty"YdS0i}d}zt||\}}}WntyVYqzYn0|}t||t|<|d7}q,|Sr )r r RegEnumValuelower convert_mbcs)rrrdrnamevaluetyperrr read_valuesHs    r cCs8t|dd}|dur4z |d}Wnty2Yn0|S)Ndecodembcs)getattr UnicodeError)sZdecrrrr]s   rc@s,eZdZddZddZddZddZd S) MacroExpandercCsi|_||dSN)macros load_macros)selfversionrrr__init__gszMacroExpander.__init__cCs2tD](}t||}|r|||jd|<q.qdS)Nz$(%s))HKEYSr r()r*Zmacropathrrrrrr set_macroks  zMacroExpander.set_macroc Csd|}|d|dd|d|ddd}|d|d z*|d krX|d |d n|d |d Wn,ty}ztdWYd}~n d}~00d}tD]T}zt||}WntyYqYn0t|d}t|d||f} | d|jd<qdS)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%s\%sr+z$(FrameworkVersion)) r/KeyErrorrr-r r rr r() r*r+ZvsbaseZnetexcprhrrrrrr)rs,   zMacroExpander.load_macroscCs$|jD]\}}|||}q |Sr')r(itemsreplace)r*r%rvrrrsubszMacroExpander.subN)__name__ __module__ __qualname__r,r/r)r7rrrrr&fsr&cCsd}tj|}|dkrdS|t|}tj|ddd\}}t|ddd}|dkrf|d7}t|dd d }|dkrd }|dkr||SdS) NzMSC v. r g$@r)sysr+findlensplitint)prefixrr%restZ majorVersionZ minorVersionrrrget_build_versions  rIcCs@d}tj|}|dkrdStjd|}tj|t||S)Nz bit (r;Intel))rBr+rCrD)rGrjrrrget_build_architectures  rMcCs0g}|D]"}tj|}||vr||q|Sr')osr.normpathr)pathsZ reduced_pathsr2Znprrrnormalize_and_reduce_pathss   rQc @seZdZdZiZdgZgdZdgZdgZeeeeZ dZ dZ dZ d Z d ZZd Zd*d dZddZd+ddZd,ddZd-ddZd.ddZddZddZdd Zd/d!d"Zd#d$Zd0d&d'Zd(d)ZdS)1 MSVCCompilerZmsvcz.c)z.ccz.cppz.cxx.rcz.mcz.resz.objz.libz.dllz%s%sz.exercCsvt||||t|_t|_|jdkr\|jdkrHd|_t|j|_nd|_d|j|_ nd|jd|_ d|_ dS) NrJzSoftware\Microsoft\VisualStudiozSoftware\Microsoft\DevstudiozVisual Studio version %szMicrosoft SDK compiler %sr<F) rr,rI_MSVCCompiler__versionrM_MSVCCompiler__arch_MSVCCompiler__rootr&_MSVCCompiler__macros_MSVCCompiler__product initialized)r*verboseZdry_runZforcerrrr,s  zMSVCCompiler.__init__cCsg|_dtjvrDdtjvrD|drDd|_d|_d|_d|_d|_nx| d|_t |jd krlt d |j |d|_|d|_|d|_|d|_|d|_| d | d z&tjdd D]}|j|qWntyYn0t|j|_d |jtjd<d|_|jdkr|jdkrt|j||dS||dSq>|jdkrtD]&}t|d|jdur|dqqgS) Nz dirsrTz6%s\%0.1f\VC\VC_OBJECTS_PLATFORM_INFO\Win32\Directoriesz?%s\6.0\Build System\Components\Platforms\Win32 (%s)\Directoriesr]r<z%s\6.0zIt 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_regrUrWr-r rXr7rEr)r*r.platformrrrrrrrsKs,      zMSVCCompiler.get_msvc_pathscCs6|dkr|d}n ||}|r2d|tj|<dS)Nr\Zlibraryr])rsrurNrm)r*rr2rrrrtos   zMSVCCompiler.set_path_env_var)rrr)rr{)NNNrNNN)NrN) NNNNNrNNNN)r)r)r8r9r:Z compiler_typeZ executablesrrrrrrrZstatic_lib_extensionZshared_lib_extensionZstatic_lib_formatZshared_lib_formatZ exe_extensionr,rzrrrrrrrrrnrsrtrrrrrRs^ B  X  S  $rRg @z3Importing new compiler from distutils.msvc9compiler)rR)r&),rBrNZdistutils.errorsrrrrrZdistutils.ccompilerrrZ distutilsr rwinregZhkey_modZ OpenKeyExr ZEnumKeyrZ EnumValuererrorr ImportErrorZwin32apiZwin32coninfoZ HKEY_USERSHKEY_CURRENT_USERHKEY_LOCAL_MACHINEZHKEY_CLASSES_ROOTr-rr rr&rIrMrQrRrZOldMSVCCompilerZdistutils.msvc9compilerrrrr s^        - 9