~fUdZddlmZddlZddlmZmZddlmZm Z m Z m Z ddl m Z ddlZddlZddlZddl Z ddlZddlmZddlmZesej.d k(r ddlZdd lmZnGd d ZeZd ed<dZdZdddddZdZdZ dZ!d"dZ"GddZ#GddZ$GddZ%Gd 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. ) annotationsN)listdirpathsep)joinisfileisdirdirname)CalledProcessError) TYPE_CHECKING)unique_everseenWindows)environceZdZdZdZdZdZy)winregN)__name__ __module__ __qualname__ HKEY_USERSHKEY_CURRENT_USERHKEY_LOCAL_MACHINEHKEY_CLASSES_ROOTX/var/lib/jenkins/workspace/mettalog/venv/lib/python3.12/site-packages/setuptools/msvc.pyrr#s  ! rrzdict[str, str]rc2 tjtjddtjtjz}d}d}|5t jD]e} tj||\}}}|s!|tjk(s5t|sA tt|}|dk\s\||kDsb||}}gddd||fS#t $rYywxYw#t $rY'wxYw#ttf$rYwxYw#1swY||fSxYw)0Python 3.8 "distutils/_msvccompiler.py" backportz'Software\Microsoft\VisualStudio\SxS\VC7rNNN)rOpenKeyrKEY_READKEY_WOW64_32KEYOSError itertoolscount EnumValueREG_SZrintfloat ValueError TypeError)key best_versionbest_dirivvc_dirvtversions r_msvc14_find_vc2015r3,snn  % % 6 OOf44 4  LH ="A  & 0 0a 8 62R6==(U6]!%(mGb=W|%;-4f(L# =  !!%    #I. =  !!s~AC D &C%D D  D $C58D >D D  C"!C"% C2.D 1C22D 5DD DD  Dc tjdxstjd}|syd}|D]}tjtt t 5tjt|ddddd d |d d d dg jddj}t|ddd}t|rd|fcdddcS dddy#1swYxYw)aPython 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 Installerz vswhere.exez-latestz -prereleasez -requiresz -propertyinstallationPathz -products*mbcsstrict)encodingerrorsVC AuxiliaryBuildN) rget contextlibsuppressr r"UnicodeDecodeError subprocess check_outputrdecodestripr)rootsuitable_components componentpaths r_msvc14_find_vc2017rNJs ;;* + Jw{{>/JD  )  !3W>P Q ''8+}U!& ) 9  dK9DT{4x'  $%  ). +  s A&CC! x86x64armarm64)rO x86_amd64x86_arm x86_arm64c t\}}d}|tvr t|}nd|vrdnd}|r.t|ddddd|d d } d dl}|j|d d}|st\}}|rt|d|dd }|syt|d}t|sy|r t|sd}||fS#tt t f$rd}YfwxYw)rNamd64rPrOz..redistMSVCz**zMicrosoft.VC14*.CRTzvcruntime140.dllrT) recursivezMicrosoft.VC140.CRTrz vcvarsall.bat) rNPLAT_SPEC_TO_RUNTIMErglob ImportErrorr" LookupErrorr3r) plat_spec_r- vcruntimevcruntime_platvcredistr]r, vcvarsalls r_msvc14_find_vcvarsallrfs%'KAxI((-i8")Y"6E        !      (d ;B?I !4!6 h %" I X/I )  F9- i 1Wk2 I sB((CCcdtvr6tjDcic]\}}|j|c}}St|\}}|stj j d tjdj||tjjdd}d |jDDcic]\}}}|r|r|j|}}}}|r||d <|Scc}}w#tj$r>}tj j dj|j|d }~wwxYwcc}}}w) rDISTUTILS_USE_SDKzUnable to find vcvarsall.batzcmd /u /c "{}" {} && set)stderrzutf-16lereplace)r=zError executing {}Nc3>K|]}|jdyw)=N) partition).0lines r z%_msvc14_get_vc_env..sOddnnS1Ospy_vcruntime_redist)ritemslowerrf distutilsr=DistutilsPlatformErrorrFrGformatSTDOUTrHr cmd splitlines) r`r+valuererboutexcraenvs r_msvc14_get_vc_envr~sGg%5<]]_EzsE U"EE1)<Iy 556TUU%% & - -i C$$  &I& . Pcnn>NO   CE 5 U C  %. !" J1F  ( (55 ' ' 0    s$C=/AD EE9EEc~ t|S#tjj$r}t |dd}~wwxYw)a* Patched "distutils._msvccompiler._get_vc_env" for support extra Microsoft Visual C++ 14.X compilers. Set environment without use of "vcvarsall.bat". Parameters ---------- plat_spec: str Target architecture. Return ------ dict environment ,@N)r~rtr=ru_augment_exception)r`r|s rmsvc14_get_vc_envrs;&!),,    2 23% s < 7<cV|jd}d|jvsd|jvrnd}|jdit}d}|dk(r.|jj ddkDr|d z }n#|d z }n|d k(r|d z }||d zz }n |dk\r|dz }|f|_y)zl Add details to the exception message to help guide the user as to what action will resolve it. rrezvisual cz;Microsoft Visual C++ {version:0.1f} or greater is required.z-www.microsoft.com/download/details.aspx?id=%d"@ia64r[z( Get it with "Microsoft Windows SDK 7.0"z% Get it from http://aka.ms/vcpython27$@z* Get it with "Microsoft Windows SDK 7.1": iW rzd Get it with "Microsoft C++ Build Tools": https://visualstudio.microsoft.com/visual-cpp-build-tools/Nr)argsrsrvlocalsfind)r|r2archmessagetmpl msdownloads rrrs hhqkGgmmo%w}})FL$++))D c>zz|  (2-EE BB _ C CG zD( (G _ , G zCHrceZdZdZej ddj ZdZe dZ dZ dZ d dZ d d Zd d Zy ) PlatformInfoz Current and Target Architectures information. Parameters ---------- arch: str Target architecture. processor_architecturecN|jjdd|_y)NrPrW)rsrjr)selfrs r__init__zPlatformInfo.__init__!sJJL((8 rcX|j|jjddzdS)zs Return Target CPU architecture. Return ------ str Target CPU raN)rrrs r target_cpuzPlatformInfo.target_cpu$s(yy,q0233rc |jdk(S)z Return True if target CPU is x86 32 bits.. Return ------ bool CPU is x86 32 bits rOrrs r target_is_x86zPlatformInfo.target_is_x860s%''rc |jdk(S)z Return True if current CPU is x86 32 bits.. Return ------ bool CPU is x86 32 bits rO current_cpurs rcurrent_is_x86zPlatformInfo.current_is_x86;s5((rcl|jdk(r|rdS|jdk(r|rdSd|jzS)uk Current platform specific subfolder. Parameters ---------- hidex86: bool return '' and not '†' if architecture is x86. x64: bool return 'd' and not 'md64' if architecture is amd64. Return ------ str subfolder: ' arget', or '' (see hidex86 parameter) rOrrW\x64\%srrhidex86rPs r current_dirzPlatformInfo.current_dirFsO$  E)g    G+ $***  rcl|jdk(r|rdS|jdk(r|rdSd|jzS)ar Target platform specific subfolder. Parameters ---------- hidex86: bool return '' and not '\x86' if architecture is x86. x64: bool return '\x64' and not '\amd64' if architecture is amd64. Return ------ str subfolder: '\current', or '' (see hidex86 parameter) rOrrWrrrrs r target_dirzPlatformInfo.target_dir^sI$5(W  7*s $//)  rc|rdn |j}|j|k(rdS|jjdd|zS)ap Cross platform specific subfolder. Parameters ---------- forcex86: bool Use 'x86' as current architecture even if current architecture is not x86. Return ------ str subfolder: '' if target architecture is current architecture, '\current_target' if not. rOr\z\%s_)rrrrj)rforcex86currents r cross_dirzPlatformInfo.cross_dirvsN $%)9)9')  "**471BC rN)FFF)rrr__doc__rrBrsrrpropertyrrrrrrrrrrrsW'++6;AACK9 4 4 ( ) 0 0 rrceZdZdZej ej ejejfZ dZ e dZ e dZ e dZe dZe dZe dZe d Ze d Ze d Zdd Zd Zy) RegistryInfoz Microsoft Visual Studio related registry information. Parameters ---------- platform_info: PlatformInfo "PlatformInfo" instance. c||_yN)pi)r platform_infos rrzRegistryInfo.__init__s rcy)z Microsoft Visual Studio root registry key. Return ------ str Registry key VisualStudiorrs r visualstudiozRegistryInfo.visualstudiosrc.t|jdS)z Microsoft Visual Studio SxS registry key. Return ------ str Registry key SxS)rrrs rsxszRegistryInfo.sxssD%%u--rc.t|jdS)z| Microsoft Visual C++ VC7 registry key. Return ------ str Registry key VC7rrrs rvczRegistryInfo.vcDHHe$$rc.t|jdS)z Microsoft Visual Studio VS7 registry key. Return ------ str Registry key VS7rrs rvszRegistryInfo.vsrrcy)z Microsoft Visual C++ for Python registry key. Return ------ str Registry key zDevDiv\VCForPythonrrs r vc_for_pythonzRegistryInfo.vc_for_pythons%rcy)zq Microsoft SDK registry key. Return ------ str Registry key zMicrosoft SDKsrrs r microsoft_sdkzRegistryInfo.microsoft_sdks rc.t|jdS)z Microsoft Windows/Platform SDK registry key. Return ------ str Registry key r rrrs r windows_sdkzRegistryInfo.windows_sdksD&& 22rc.t|jdS)z Microsoft .NET Framework SDK registry key. Return ------ str Registry key NETFXSDKrrs r netfx_sdkzRegistryInfo.netfx_sdksD&& 33rcy)z Microsoft Windows Kits Roots registry key. Return ------ str Registry key zWindows Kits\Installed Rootsrrs rwindows_kits_rootszRegistryInfo.windows_kits_rootss/rc^|jjs|rdnd}td|d|S)a Return key in Microsoft software registry. Parameters ---------- key: str Registry key path where look. x86: str Force x86 software registry. Return ------ str Registry key r Wow6432NodeSoftware Microsoft)rrr)rr+rOnode64s r microsoftzRegistryInfo.microsofts- ww--/3MJ S99rc  tj}tj}tj}|j}|j D]>}d} ||||d|} tj||d|r ||cScSy#t $rC|jjs$ ||||dd|}n#t $rYYwxYwYYvwxYw#t $rYnwxYw |s||#|r ||wwxYw)a Look for values in registry in Microsoft software registry. Parameters ---------- key: str Registry key path where look. name: str Value name to find. Return ------ str value NrT) rr rCloseKeyrHKEYSr"rr QueryValueEx) rr+namekey_readopenkeyclosekeymshkeybkeys rlookupzRegistryInfo.lookup!s ??..?? ^^JJDD tRWa: #**46q9TN#& ww--/!&tRT]AxH"! !    TNTNsZB !C #C/CC C CCCC C&#C6%C&&C66 DNr)rrrrrrrrrrrrrrrrrrrrrrrrrrrrs   !!   E    . . % % % % % %     3 3 4 4 / /:&'rrceZdZdZej ddZej ddZej deZddZ dZ d Z d Z e d Zed Zed ZdZdZedZedZedZedZedZedZedZedZedZedZedZedZedZ dZ!e d dZ"y)! SystemInfoz Microsoft Windows and Visual Studio related system information. Parameters ---------- registry_info: RegistryInfo "RegistryInfo" instance. vc_ver: float Required Microsoft Visual C++ version. WinDirrr6r5Nc||_|jj|_|j|_|xs|j x|_|_yr)rirfind_programdata_vs_versknown_vs_paths_find_latest_available_vs_vervs_vervc_ver)r registry_infors rrzSystemInfo.__init__]sG''**";;=%+$Rd.P.P.RR dkrc|j}|s+|jstjj dt |}|j |jt|dS)zm Find the latest VC version Return ------ float version z%No Microsoft Visual C++ version foundr[)find_reg_vs_versrrtr=rusetupdatesorted)r reg_vc_versvc_verss rrz(SystemInfo._find_latest_available_vs_verfsf++- t22""997 k"t**+gr""rc |jj}|jj|jj|jjf}g}t j |jj|D]'\}} tj|||dtj}|5tj|\}}} t|D][} tjt 5t#tj$|| d} | |vr|j'| ddd]t|D]X} tjt 5t#tj(|| } | |vr|j'| dddZ ddd*t+|S#t$rYBwxYw#1swYxYw#1swYxYw#1swYhxYw)z Find Microsoft Visual Studio versions available in registry. Return ------ list of float Versions rN)rrrrrr#productrrrr r" QueryInfoKeyrangerCrDr)r(r%appendEnumKeyr) rrvckeysvs_versrr+rsubkeysvaluesrar.vers rrzSystemInfo.find_reg_vs_verszsWW  ''**dgg33TWWZZ@"**477==&AID# ~~dBsGQH 0%+%8%8%>"vA#,,Z80#F$4$4T1$=a$@Ag-#NN3/00' wA#,,Z80#FNN4$;<g-#NN3/00( 0 0 B"g   00 00 0 0sO ,F::AG";8G 31G"$5G  G": GG G G"G G""G, cni}d} t|}|D]m} t||d}t|dd5}t j |}dddd}tt|d|||j |d <o|S#t$r|cYSwxYw#1swYOxYw#ttf$rYwxYw) z Find Visual studio 2017+ versions from information in "C:\ProgramData\Microsoft\VisualStudio\Packages\_Instances". Return ------ dict float version as key, path as value. z9C:\ProgramData\Microsoft\VisualStudio\Packages\_Instancesz state.jsonrtzutf-8)r<Nr8 VC\Tools\MSVCinstallationVersion)rr"ropenjsonload_as_float_versionKeyError) r vs_versions instances_dir hashed_namesr state_path state_filestatevs_paths rrz#SystemInfo.find_programdata_vs_verss T  "=1L !D !-|D *dW=2 IIj1E2 23W&678D2259N3OPQ!(1   22X&  s9 BB"B9B" BBB B""B43B4cZtdj|jdddS)z Return a string version as a simplified float version (major.minor) Parameters ---------- version: str Version. Return ------ float version .N)r(rsplit)r2s rrzSystemInfo._as_float_versions(SXXgmmC0!4566rct|jd|jz}|jj |jj d|jzxs|S)zp Microsoft Visual Studio directory. Return ------ str path zMicrosoft Visual Studio %0.1f%0.1f)rProgramFilesx86rrrr)rdefaults r VSInstallDirzSystemInfo.VSInstallDirsP  "ADKK"O  ww~~dggjj'DKK*?@KGKrc|jxs|j}t|s!d}tjj ||S)zm Microsoft Visual C++ directory. Return ------ str path z(Microsoft Visual C++ directory not found) _guess_vc_guess_vc_legacyrrtr=ru)rrMmsgs r VCInstallDirzSystemInfo.VCInstallDirsF~~:4#8#8#:T{ > rc0|jdkry |j|j}t |d} t |d}|j ||_t ||S#t$r|j}YTwxYw#ttf$rYywxYw)zl Locate Visual C++ for VS2017+. Return ------ str path rrrr[) rrrrrrrrr" IndexError)rvs_dirguess_vcrs rrzSystemInfo._guess_vcs ;;$  '((5F  01 X&r*F008DK&) ) '&&F '$  s"A(/B(B?BBBc|t|jd|jz}t|jjd|jz}|jj |d}|r t|dn|}|jj |jj d|jzxs|S)z{ Locate Visual C++ for versions prior to 2017. Return ------ str path z Microsoft Visual Studio %0.1f\VCr installdirr>)rrrrrrr)rrreg_path python_vc default_vcs rrzSystemInfo._guess_vc_legacys  "E "S  --w/DEGGNN8\: .7T)T*W ww~~dggjj'DKK*?@NJNrc|jdkry|jdk(ry|jdk(ry|jdk(ry|jd k\ry y ) z Microsoft Windows SDK versions for specified MSVC++ version. Return ------ tuple of str versions r)z7.0z6.1z6.0ar)z7.1z7.0a&@)z8.0z8.0a(@)8.1z8.1ar)z10.0r)Nrrs rWindowsSdkVersionzSystemInfo.WindowsSdkVersion+sR ;;# ' [[D  [[D  [[D  [[D  rcL|jt|jdS)zt Microsoft Windows SDK last version. Return ------ str version lib)_use_last_dir_namer WindowsSdkDirrs rWindowsSdkLastVersionz SystemInfo.WindowsSdkLastVersionAs"&&tD,>,>'FGGrcd}|jD]E}t|jjd|z}|jj |d}|sEn|r t |sWt|jj d|jz}|jj |d}|r t|d}|r t |sN|jD]?}|d|jd}d |z}t|j|}t |s>|}A|r t |s:|jD]+}d |z}t|j|}t |s*|}-|st|jd }|S) zn Microsoft Windows SDK directory. Return ------ str path rzv%sinstallationfolderrr"WinSDKNrzMicrosoft SDKs\Windows Kits\%szMicrosoft SDKs\Windows\v%s PlatformSDK) r+rrrrrrrrfindr6r)rsdkdirrlocrM install_baseintverds rr/zSystemInfo.WindowsSdkDirMsP))Ctww**ECK8CWW^^C)=>F * U6]--w/DED77>>$ =LlH5U6]---syy~.86A**D18F . U6]--4s:**D18F . $++];F rc|jdkrd}d}n2d}|jdkrdnd}|jjd|}d ||jd d fz}g}|jd k\r6|jD]'}|t |j j||gz })|jD]*}|t |j jd |z|gz },|D]$}|j j|d}|s"|cSy)zy Microsoft Windows SDK executable directory. Return ------ str path r'#r(r(TF)rPrzWinSDK-NetFx%dTools%sr-rzv%sAr2N) rrrrjNetFxSdkVersionrrrr+rr) rnetfxverrrfxregpathsrrMexecpaths rWindowsSDKExecutablePathz#SystemInfo.WindowsSDKExecutablePathxs  ;;$ HDH"kkT1duG77&&4&AD $$,,tS2I'J J ;;$ ++T$''"3"3S"=>>,))C dgg116C<DE EH*Dww~~d,@AH rct|jjd|jz}|jj |dxsdS)zl Microsoft Visual F# directory. Return ------ str path z%0.1f\Setup\F# productdirr)rrrrr)rrMs rFSharpInstallDirzSystemInfo.FSharpInstallDirs>DGG((*;dkk*IJww~~dL17R7rc|jdk\rdnd}|D]?}|jj|jjd|z}|s9|xsdcSy)zt Microsoft Universal CRT SDK directory. Return ------ str path r)1081rz kitsroot%srN)rrrr)rversrr6s rUniversalCRTSdkDirzSystemInfo.UniversalCRTSdkDirsW ${{d2|CWW^^DGG$>$> s@RSF|# rcL|jt|jdS)z Microsoft Universal C Runtime SDK last version. Return ------ str version r-)r.rrLrs rUniversalCRTSdkLastVersionz%SystemInfo.UniversalCRTSdkLastVersions"&&tD,C,CU'KLLrc(|jdk\rdSdS)z Microsoft .NET Framework SDK versions. Return ------ tuple of str versions r) z4.7.2z4.7.1z4.7z4.6.2z4.6.1z4.6z4.5.2z4.5.1z4.5rr*rs rr?zSystemInfo.NetFxSdkVersions%{{d" X  rcd}|jD]C}t|jj|}|jj |d}|sB|S|S)zu Microsoft .NET Framework SDK directory. Return ------ str path rkitsinstallationfolder)r?rrrr)rr6rr7s r NetFxSdkDirzSystemInfo.NetFxSdkDirsV''Ctww((#.CWW^^C)ABF (  rct|jd}|jj|jjdxs|S)zw Microsoft .NET Framework 32bit directory. Return ------ str path zMicrosoft.NET\Frameworkframeworkdir32rrrrrrguess_fws rFrameworkDir32zSystemInfo.FrameworkDir32s: %?@ww~~dggjj*:;GxGrct|jd}|jj|jjdxs|S)zw Microsoft .NET Framework 64bit directory. Return ------ str path zMicrosoft.NET\Framework64frameworkdir64rUrVs rFrameworkDir64zSystemInfo.FrameworkDir64s: %ABww~~dggjj*:;GxGrc$|jdS)z Microsoft .NET Framework 32bit versions. Return ------ tuple of str versions _find_dot_net_versionsrs rFrameworkVersion32zSystemInfo.FrameworkVersion32**2..rc$|jdS)z Microsoft .NET Framework 64bit versions. Return ------ tuple of str versions @r^rs rFrameworkVersion64zSystemInfo.FrameworkVersion64rarc||jj|jjd|z}t|d|z}|xs|j |dxsd}|j dk\r|dfS|j dk\r|j dd d k7rd d fS|d fS|j d k(ry|j dk(ryy)z Find Microsoft .NET Framework versions. Parameters ---------- bits: int Platform number of bits: 32 or 64. Return ------ tuple of str versions zframeworkver%dzFrameworkDir%dr/rr(zv4.0rNrv4z v4.0.30319v3.5r)rg v2.0.50727g @)zv3.0rh)rrrgetattrr.rrs)rbitsreg_ver dot_net_dirrs rr_z!SystemInfo._find_dot_net_versions&s''..-=-DEd$4t$;< H00cBHb ;;$ ;  [[D #&99;r?d#:.Us5 T$)*x/B/B6/J  s25Nr)reversedrnext)rMrq matching_dirss`` rr.zSystemInfo._use_last_dir_nameDs/" $WT]3 M4(.B.rrr)#rrrrrrBrr6rrrrr staticmethodrrrrrrr+r0r/rDrGrLrNr?rRrXr[r`rdr_r.rrrrrKs W[[2 &F7;;~r2L!gkk"5|DOS#(>(T77 LL""<O** H H((T""H 8 8( M M  " H H H H / / / /<//rrceZdZdZddZedZedZedZedZ edZ ed Z ed Z ed Z ed Zed ZedZdZedZedZedZedZedZedZedZedZedZedZedZedZedZd dZdZ y)!EnvironmentInfoaY Return environment variables for specified Microsoft Visual C++ version and platform : Lib, Include, Path and libpath. This function is compatible with Microsoft Visual C++ 9.0 to 14.X. Script created by analysing Microsoft environment configuration files like "vcvars[...].bat", "SetEnv.Cmd", "vcbuildtools.bat", ... Parameters ---------- arch: str Target architecture. vc_ver: float Required Microsoft Visual C++ version. If not set, autodetect the last version. vc_min_ver: float Minimum Microsoft Visual C++ version. Nct||_t|j|_t |j||_|j |kr!d}tjj|y)Nz.No suitable Microsoft Visual C++ version found) rrrrrsirrtr=ru)rrr vc_min_vererrs rrzEnvironmentInfo.__init__us]t$tww'TWWf- ;; #BC""99#> > $rc.|jjS)zk Microsoft Visual Studio. Return ------ float version )rzrrs rrzEnvironmentInfo.vs_ver~ww~~rc.|jjS)zp Microsoft Visual C++ version. Return ------ float version )rzrrs rrzEnvironmentInfo.vc_verr~rcddg}|jdk\r2|jjdd}|dgz }|dgz }|d|zgz }|Dcgc]"}t|jj |$c}Scc}w) zu Microsoft Visual Studio Tools. Return ------ list of str paths z Common7\IDEz Common7\ToolsrTrrPz1Common7\IDE\CommonExtensions\Microsoft\TestWindowzTeam Tools\Performance ToolszTeam Tools\Performance Tools%s)rrrrrzr)rpaths arch_subdirrMs rVSToolszEnvironmentInfo.VSToolss !12 ;;$ ''--d-EK JK KE 56 6E 7+EF FE=BCTTWW))40CCCs 'A4ct|jjdt|jjdgS)z Microsoft Visual C++ & Microsoft Foundation Class Includes. Return ------ list of str paths IncludezATLMFC\Include)rrzrrs r VCIncludeszEnvironmentInfo.VCIncludess7 %%y 1 %%'8 9  rc<|jdk\r|jjd}n|jjd}d|zd|zg}|jdk\r |d|zgz }|Dcgc]"}t|jj |$c}Scc}w) z Microsoft Visual C++ & Microsoft Foundation Class Libraries. Return ------ list of str paths .@TrPrLib%sz ATLMFC\Lib%srz Lib\store%s)rrrrrzr)rrrrMs r VCLibrarieszEnvironmentInfo.VCLibrariess ;;$ '',,,6K'',,T,:K;&+(EF ;;$  n{23 3E=BCTTWW))40CCCs/'Bcf|jdkrgSt|jjdgS)z Microsoft Visual C++ store references Libraries. Return ------ list of str paths rzLib\store\references)rrrzrrs r VCStoreRefszEnvironmentInfo.VCStoreRefss0 ;; ITWW))+BCDDrcB|j}t|jdg}|jdkrdnd}|jj |}|r|t|jd|zgz }|jdk(r;d|jj dz}|t|j|gz }|S|jdk\r|jjrd nd }|t|j||jjd zgz }|jj|jjk7r7|t|j||jj d zgz }|S|t|jd gz }|S) zr Microsoft Visual C++ Tools. Return ------ list of str paths VCPackagesrTFBin%srrrz bin\HostX86%sz bin\HostX64%srBin) rzrrrrrrrrrr)rrztoolsrrrMhost_dirs rVCToolszEnvironmentInfo.VCToolss}WWboo|45;;$.4Egg''1  d2??Gk,ABC CE ;;$ TWW000>>D d2??D12 2E  [[D $(GG$:$:$< BR  d2??Htww7I7Id7I7S,STU UEww""dgg&8&88(TWW5H5HT5H5R*RS  d2??E23 3E rcV|jdkrA|jjdd}t|jj d|zgS|jjd}t|jj d}|j }t||d|gS)zw Microsoft Windows SDK Libraries. Return ------ list of str paths rTrrrr-um)rrrrrzr/ _sdk_subdir)rrr-libvers r OSLibrarieszEnvironmentInfo.OSLibrariess ;;$ '',,Tt,DK..+0EFG G'',,,6Ktww,,e4C%%F&+>?@ @rct|jjd}|jdkr|t|dgS|jdk\r |j}nd}t|d|zt|d|zt|d|zgS) zu Microsoft Windows SDK Include. Return ------ list of str paths includerglrrz%ssharedz%sumz%swinrt)rrzr/rr)rrsdkvers r OSIncludeszEnvironmentInfo.OSIncludesstww,,i8 ;;$ T'401 1{{d"))Wj612Wfvo.Wi&01 rct|jjd}g}|jdkr||jz }|jdk\r|t|dgz }|jdk\rz||t|jjdt|ddt|d dt|d dt|jjd d d |jzdddgz }|S)z} Microsoft Windows SDK Libraries Paths. Return ------ list of str paths Referencesrr'zCommonConfiguration\Neutralr UnionMetadataz'Windows.Foundation.UniversalApiContractz1.0.0.0z%Windows.Foundation.FoundationContractz,Windows.Networking.Connectivity.WwanContract ExtensionSDKszMicrosoft.VCLibsrCommonConfigurationneutral)rrzr/rr)rreflibpaths r OSLibpathzEnvironmentInfo.OSLibpath0s477((,7 ;;#  t'' 'G ;;$  S"@AB BG ;;$  TWW**O<SCYOSA9MSH)TGG))#&dkk) )  G rc4t|jS)zs Microsoft Windows SDK Tools. Return ------ list of str paths )list _sdk_toolsrs rSdkToolszEnvironmentInfo.SdkToolsVsDOO%&&rc#rK|jdkr5|jdkrdnd}t|jj||jj sC|jj d}d|z}t|jj||jdvrb|jjrd }n|jj dd }d |z}t|jj|ns|jdk\rdt|jjd}|jj d}|jj}t||||jjr|jjy y w) z Microsoft Windows SDK Tools paths generator. Return ------ generator of str paths rr'rzBin\x86Trr)rr'rrzBin\NETFX 4.0 Tools%sN) rrrzr/rrrrr0rD)rbin_dirrrMrs rrzEnvironmentInfo._sdk_toolsbs\ ;; #{{d2e Gtww,,g6 6ww%%'''--$-7K[(Dtww,,d3 3 ;;, &ww$$& "gg11$D1I +k9Dtww,,d3 3 [[D --u5D''--$-7KWW22Ftv{;< < 77 + +''22 2 ,sF5F7c@|jj}|rd|zSdS)zu Microsoft Windows SDK version subdir. Return ------ str subdir %s\r)rzr0rucrtvers rrzEnvironmentInfo._sdk_subdirs%''//%, 4"4rcf|jdkDrgSt|jjdgS)zs Microsoft Windows SDK Setup. Return ------ list of str paths rSetup)rrrzr/rs rSdkSetupzEnvironmentInfo.SdkSetups/ ;; ITWW**G455rc |j}|j}|jdkr'd}|j xr|j }nB|jxs|j }|j dk(xs|j dk(}g}|r1||jDcgc]}t|j|c}z }|r1||jDcgc]}t|j|c}z }|Scc}wcc}w)zv Microsoft .NET Framework Tools. Return ------ list of str paths rTrW) rrzrrrrrr`rrXrdr[)rrrz include32 include64rrs rFxToolszEnvironmentInfo.FxToolssWW WW ;;$ I,,..Jr7H7H7J3JI((*Ab.?.?.AI'1MR]]g5MI  b>S>STsd2,,c2T TE  b>S>STsd2,,c2T TE UTs $C;Dc|jdks|jjsgS|jj d}t |jjd|zgS)z~ Microsoft .Net Framework SDK Libraries. Return ------ list of str paths rTrzlib\um%s)rrzrRrrr)rrs rNetFxSDKLibrariesz!EnvironmentInfo.NetFxSDKLibrariessW ;; TWW%8%8Igg((T(2 TWW((+ *CDEErc|jdks|jjsgSt|jjdgS)z} Microsoft .Net Framework SDK Includes. Return ------ list of str paths rz include\um)rrzrRrrs rNetFxSDKIncludesz EnvironmentInfo.NetFxSDKIncludess; ;; TWW%8%8ITWW((-899rcDt|jjdgS)z Microsoft Visual Studio Team System Database. Return ------ list of str paths z VSTSDB\Deploy)rrzrrs rVsTDbzEnvironmentInfo.VsTDbsTWW))+;<==rcX|jdkrgS|jdkr3|jj}|jj d}n|jj }d}d|j|fz}t ||g}|jdk\r|t ||dgz }|S)zn Microsoft Build Engine. Return ------ list of str paths r(rTrrzMSBuild\%0.1f\bin%sRoslyn)rrzrrrrr)r base_pathrrMbuilds rMSBuildzEnvironmentInfo.MSBuilds ;; I [[4 //I''--d-;K,,IK%k(BBi&' ;;$  d9dH56 6E rcf|jdkrgSt|jjdgS)zt Microsoft HTML Help Workshop. Return ------ list of str paths r'zHTML Help Workshop)rrrzrrs rHTMLHelpWorkshopz EnvironmentInfo.HTMLHelpWorkshops0 ;; ITWW,,.BCDDrc|jdkrgS|jjd}t|jj d}|j }t||d|gS)z Microsoft Universal C Runtime SDK Libraries. Return ------ list of str paths rTrr-ucrt)rrrrrzrL _ucrt_subdir)rrr-rs r UCRTLibrarieszEnvironmentInfo.UCRTLibrariessb ;; Igg((T(2 477--u5##S=>??rc|jdkrgSt|jjd}t|d|jzgS)z Microsoft Universal C Runtime SDK Include. Return ------ list of str paths rrz%sucrt)rrrzrLr)rrs r UCRTIncludeszEnvironmentInfo.UCRTIncludes$sF ;; Itww119=Wh):)::;< WW)) j00JGH  {GK,@,DEK d; &BC CHT*h/00 !DKK"$4 5 C $4r$9 :  )008DOFG Wi@Dd|  Erct|jd|j|j|j|j g||jd|j |j|j|j|jg||jd|j |j|j|jg||jd|j|j|j|j |j"|j|j$|j&|j(g |}|j*dk\r$t-|j.r|j.|d<|S)z Return environment dict. Parameters ---------- exists: bool It True, only return existing paths. Return ------ dict environment rr-rrM)rr-rrMrrq)dict _build_pathsrrrrrrrrrrrrrrrrrrrrrr)rexistsr}s r return_envzEnvironmentInfo.return_envvsW%%OOOO%%))   !!$$$$LL&&**  %%!!4<<1A1A4>>R ""LLLLJJMMMMLLLL))KK 7* V ;;" (<( >&|4 ||L))r)Nr)T)!rrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrxrx]s.?    DD&    DD( E E##JAA&2##J ' '!3F 5 5 6 64 F F : : > >6 E E@@" = = 5 5 * *##J;z*rrxru)'r __future__rrosrros.pathrrrr rFr rCplatformr#distutils.errorsrttypingr setuptools.extern.more_itertoolsr systemrrr__annotations__r3rNr\rfr~rrrrrrxrrrrs # 00) <*i7!! #fG^$"<,`  2 j<4$Nv v rzzzO/O/du *u *r