_i> h d Z ddlZddlmZ ddlmZmZ ddlmZm Z m Z mZ ddlm Z ddlZddlZddlZddlZddlZddlmZ ej* dk( rddlZdd lmZ n G d d Z e Zd Zd ZdddddZd Zd Zd ZddZ G d d Z G d d Z! G d d Z" G d d Z#y) a Improved support for Microsoft Visual C++ compilers. Known supported compilers: -------------------------- Microsoft Visual C++ 14.X: Microsoft Visual C++ Build Tools 2015 (x86, x64, arm) Microsoft Visual Studio Build Tools 2017 (x86, x64, arm, arm64) Microsoft Visual Studio Build Tools 2019 (x86, x64, arm, arm64) This may also support compilers shipped with compatible Visual Studio versions. N)open)listdirpathsep)joinisfileisdirdirname)CalledProcessError)unique_everseenWindows)environc e Zd ZdZdZdZdZy)winregN)__name__ __module____qualname__ HKEY_USERSHKEY_CURRENT_USERHKEY_LOCAL_MACHINEHKEY_CLASSES_ROOT /builddir/build/BUILDROOT/alt-python312-setuptools-69.0.2-3.el8.x86_64/opt/alt/python312/lib/python3.12/site-packages/setuptools/msvc.pyr r s ! r r c 2 t j t j ddt j t j z } d}d}| 5 t j D ]e } t j | | \ }}}|s!|t j k( s5t | sA t t | }|dk\ s\||kD sb||}}g ddd ||fS # t $ r Y yw xY w# t $ r Y 'w xY w# t t f$ r Y w xY w# 1 sw Y ||fS xY w)0Python 3.8 "distutils/_msvccompiler.py" backportz'Software\Microsoft\VisualStudio\SxS\VC7r NNN )r OpenKeyr KEY_READKEY_WOW64_32KEYOSError itertoolscount EnumValueREG_SZr intfloat ValueError TypeError)keybest_versionbest_dirivvc_dirvtversions r _msvc14_find_vc2015r2 ) s nn%%6 OOf444 LH "A & 0 0a 8 62 R6==(U6]!%(mG b=W|%;-4f(L # !!% #I. !!s~ AC D &C% D D D $C58D >D D C"!C"% C2.D 1C22D 5DD DD Dc t j d xs t j d } | syd}|D ] }t j t t t 5 t j t | ddd dd d |ddd dg j dd j }t |ddd }t | rd|fcddd c S ddd y# 1 sw Y xY w)a Python 3.8 "distutils/_msvccompiler.py" backport 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. ProgramFiles(x86)ProgramFilesr )z1Microsoft.VisualStudio.Component.VC.Tools.x86.x64z)Microsoft.VisualStudio.Workload.WDExpresszMicrosoft Visual Studio Installerzvswhere.exez-latestz-prereleasez -requiresz -propertyinstallationPathz -products*mbcsstrict)encodingerrorsVC AuxiliaryBuild N) r get contextlibsuppressr r! UnicodeDecodeError subprocesscheck_outputr decodestripr )rootsuitable_components componentpaths r _msvc14_find_vc2017rM G s ;;*+Jw{{>/JD ) !3W>P Q'' ";[- "%#!#*# 9# ( dK9DT{4x/ R Q, - R Q )6 3 R Qs A&CC! x86x64armarm64)rN x86_amd64x86_arm x86_arm64c t \ }}d}| t v r t | }nd| v rdnd}|r.t |ddddd|d d } ddl}|j |d d }|st \ }}|rt |d|dd }|syt |d }t | sy|rt | sd}||fS # t t t f$ r d}Y fw xY w)r Namd64rO rN z..redistMSVCz**zMicrosoft.VC14*.CRTzvcruntime140.dllr T) recursivezMicrosoft.VC140.CRTr z vcvarsall.bat) rM PLAT_SPEC_TO_RUNTIMEr globImportErrorr! LookupErrorr2 r ) plat_spec_r, vcruntimevcruntime_platvcredistr\ r+ vcvarsalls r _msvc14_find_vcvarsallre s %'KAxI((-i8")Y"6E! (d ;B?I !4!6h%"I X/I)F9- i1 Wk2 I s B( (C Cc dt v r6t j D ci c] \ }}|j | c}}S t | \ }}|st j j d t j dj || t j j dd }d |j D D ci c] \ }}}|r|r|j | }}}}|r||d<