ruạṛ
a �u:j�S � @ sB d Z ddlmZ ddlZddlZddlZddlmZ ddlZddl m Z e�e�� ddl Z W d � n1 sp0 Y ddlmZ ddlmZ ddlmZmZ dd lmZmZ d dlmZ d dlmZ d d lmZmZmZ dd� Zdd� Zddddd�Z dd� Z!dd� Z"d#dd�Z#ddddd�Z$dd � Z%G d!d"� d"ej&�Z&dS )$z�distutils._msvccompiler Contains MSVCCompiler, an implementation of the abstract CCompiler class for Microsoft Visual Studio 2015. This module requires VS 2015 or later. � )�annotationsN)�Iterable)�count� )�log)�DistutilsExecError�DistutilsPlatformError)�get_host_platform�get_platform� )�base)�gen_lib_options)�CompileError�LibError� LinkErrorc C s zt jt jdt jt jB d�} W n ty< t�d� Y dS 0 d}d }| �� t� D ]�}zt � | |�\}}}W n ty� Y q�Y n0 |rR|t j krRtj� |�rRztt|��}W n ttfy� Y qRY n0 |dkrR||krR|| }}qRW d � n1 � s�0 Y ||fS )Nz'Software\Microsoft\VisualStudio\SxS\VC7)�accesszVisual C++ is not registered�NNr � )�winreg� OpenKeyEx�HKEY_LOCAL_MACHINEZKEY_READZKEY_WOW64_32KEY�OSErrorr �debugr Z EnumValue�REG_SZ�os�path�isdir�int�float� ValueError� TypeError)�key�best_version�best_dir�i�vZvc_dir�vt�version� r( �Y/opt/bart/bart_venv/lib/python3.9/site-packages/setuptools/_distutils/compilers/C/msvc.py�_find_vc2015+ s2 � ,r* c C s� t j�d�pt j�d�} | s dS t� dkr.dnd}d|� �df}|D ]�}t�tjtt ��� t� t j�| d d d�dd d|ddddg �j ddd��� }t j�|ddd�}t j�|�r�d|fW d � S W d � qD1 s�0 Y qDdS )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)ZProgramFilesr � win-arm64�arm64zx86.x64z*Microsoft.VisualStudio.Component.VC.Tools.z)Microsoft.VisualStudio.Workload.WDExpresszMicrosoft Visual StudioZ Installerzvswhere.exez-latestz-prereleasez -requiresz -propertyZinstallationPathz -products�*�mbcs�strict)�encoding�errorsZVCZ AuxiliaryZBuild� N)r �environ�getr � contextlib�suppress� subprocess�CalledProcessErrorr �UnicodeDecodeError�check_outputr �join�decode�stripr )�root�variantZsuitable_components� componentr r( r( r) �_find_vc2017H s>