B ʀpzxS @ s d Z ddlZddlZddlZddlZddlZee ddl Z W dQ R X ddl mZmZm Z mZmZ ddlmZmZ ddlmZ ddlmZ ddlmZ dd Zd d Zdd dddZdd Zdd ZdddZdddddZG dd deZ dS )a distutils._msvccompiler Contains MSVCCompiler, an implementation of the abstract CCompiler class for Microsoft Visual Studio 2015. The module is compatible with VS 2015 and later. You can find legacy support for older versions in distutils.msvc9compiler and distutils.msvccompiler. N)DistutilsExecErrorDistutilsPlatformErrorCompileErrorLibError LinkError) CCompilergen_lib_options)log)get_platform)countc C s yt jt jdt jt jB d} W n tk r< td dS X d}d }| xt D ]}yt | |\}}}W n tk r P Y nX |rT|t j krTtj |rTytt|}W n ttfk r wTY nX |dkrT||krT|| }}qTW W d Q R X ||fS )Nz'Software\Microsoft\VisualStudio\SxS\VC7)accesszVisual C++ is not registered)NNr )winreg OpenKeyExHKEY_LOCAL_MACHINEZKEY_READZKEY_WOW64_32KEYOSErrorr debugr Z EnumValueREG_SZospathisdirintfloat ValueError TypeError)keybest_versionbest_dirivZvc_dirZvtversion r! /builddir/build/BUILDROOT/alt-python37-setuptools-58.3.0-4.el9.x86_64/opt/alt/python37/lib/python3.7/site-packages/setuptools/_distutils/_msvccompiler.py_find_vc2015 s0 r# c C s t jdpt jd} | s dS y8tjt j| dddddd d ddd dg ddd }W n tjt t fk rt dS X t j|ddd}t j|rd|fS dS )aJ Returns "15, path" based on the result of invoking vswhere.exe If no install is found, returns "None, None" The version is returned to avoid unnecessarily changing the function result. It may be ignored when the path is not None. If vswhere.exe is not available, by definition, VS 2017 is not installed. zProgramFiles(x86)ZProgramFiles)NNzMicrosoft Visual StudioZ Installerzvswhere.exez-latestz-prereleasez -requiresz1Microsoft.VisualStudio.Component.VC.Tools.x86.x64z -propertyZinstallationPathz -products*mbcsstrict)encodingerrorsZVCZ AuxiliaryZBuild )r environget subprocesscheck_outputr joinstripCalledProcessErrorr UnicodeDecodeErrorr )rootr r! r! r" _find_vc2017<