HEX
Server: LiteSpeed
System: Linux s787.bom1.mysecurecloudhost.com 4.18.0-477.13.1.lve.el8.x86_64 #1 SMP Thu Jun 1 16:40:47 EDT 2023 x86_64
User: mobilech (5348)
PHP: 8.1.34
Disabled: NONE
Upload Files
File: //opt/saltstack/salt/lib/python3.10/site-packages/setuptools/__pycache__/msvc.cpython-310.pyc
o

;j���@s$UdZddlmZddlZddlZddlZddlZddlZddlZddl	m
Z
mZmZddl
mZddlmZddlmZddlZe
rKdd	lmZmZe
s^e��d
kr^ddlZddlmZnGdd
�d
�Ze�Zded<Gdd�d�ZGdd�d�ZGdd�d�ZGdd�de�Z Gdd�d�Z!dS)zo
Environment info about Microsoft Compilers.

>>> getfixture('windows_only')
>>> ei = EnvironmentInfo('amd64')
�)�annotationsN)�
TYPE_CHECKING�	TypedDict�overload)�unique_everseen�)�StrPath)�py310)�
LiteralString�NotRequired�Windows)�environc@seZdZdZdZdZdZdS)�winregN)�__name__�
__module__�__qualname__�
HKEY_USERS�HKEY_CURRENT_USER�HKEY_LOCAL_MACHINE�HKEY_CLASSES_ROOT�rr�C/opt/saltstack/salt/lib/python3.10/site-packages/setuptools/msvc.pyr#s
rzdict[str, str]r
c@speZdZdZe�dd���Zddd	�Ze	dd
d��Z
dd
d�Zddd�Zdddd�Z
dddd�Zdddd�ZdS)�PlatformInfoz�
    Current and Target Architectures information.

    Parameters
    ----------
    arch: str
        Target architecture.
    Zprocessor_architecture��arch�str�return�NonecCs|���dd�|_dS)N�x64�amd64)�lower�replacer)�selfrrrr�__init__8szPlatformInfo.__init__cCs|j|j�d�dd�S)zs
        Return Target CPU architecture.

        Return
        ------
        str
            Target CPU
        �_rN)r�find�r"rrr�
target_cpu;s
zPlatformInfo.target_cpu�boolcC�
|jdkS)z�
        Return True if target CPU is x86 32 bits..

        Return
        ------
        bool
            CPU is x86 32 bits
        �x86�r'r&rrr�
target_is_x86G�
	zPlatformInfo.target_is_x86cCr))z�
        Return True if current CPU is x86 32 bits..

        Return
        ------
        bool
            CPU is x86 32 bits
        r*��current_cpur&rrr�current_is_x86Rr-zPlatformInfo.current_is_x86FcC�0|jdkr	|r	dS|jdkr|rdSd|j��S)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)
        r*rr�\x64�\r.�r"�hidex86rrrr�current_dir]�����
�zPlatformInfo.current_dircCr1)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)
        r*rrr2r3r+r4rrr�
target_dirur7zPlatformInfo.target_dircCs4|rdn|j}|j|krdS|���dd|�d��S)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.
        r*rr3r$)r/r'r8r!)r"�forcex86�currentrrr�	cross_dir�s
���zPlatformInfo.cross_dirN)rrrr�rr)rr()FF�F)rrr�__doc__r
�getr r/r#�propertyr'r,r0r6r8r;rrrrr,s	


rc@s�eZdZdZejejejejfZ	d)dd�Z
ed*d	d
��Zed*dd��Z
ed*d
d��Zed*dd��Zed*dd��Zed*dd��Zed*dd��Zed*dd��Zed*dd��Zed+d,dd ��Zed+d-d"d ��Zd+d-d#d �Zd.d&d'�Zd(S)/�RegistryInfoz�
    Microsoft Visual Studio related registry information.

    Parameters
    ----------
    platform_info: PlatformInfo
        "PlatformInfo" instance.
    �
platform_inforrrcCs
||_dS�N)�pi)r"rBrrrr#�s
zRegistryInfo.__init__r
cC�dS)z�
        Microsoft Visual Studio root registry key.

        Return
        ------
        str
            Registry key
        ZVisualStudiorr&rrr�visualstudio��
zRegistryInfo.visualstudiocC�tj�|jd�S)z
        Microsoft Visual Studio SxS registry key.

        Return
        ------
        str
            Registry key
        ZSxS)�os�path�joinrFr&rrr�sxs��
zRegistryInfo.sxscCrH)z|
        Microsoft Visual C++ VC7 registry key.

        Return
        ------
        str
            Registry key
        ZVC7�rIrJrKrLr&rrr�vc�rMzRegistryInfo.vccCrH)z
        Microsoft Visual Studio VS7 registry key.

        Return
        ------
        str
            Registry key
        ZVS7rNr&rrr�vs�rMzRegistryInfo.vscCrE)z�
        Microsoft Visual C++ for Python registry key.

        Return
        ------
        str
            Registry key
        zDevDiv\VCForPythonrr&rrr�
vc_for_python�rGzRegistryInfo.vc_for_pythoncCrE)zq
        Microsoft SDK registry key.

        Return
        ------
        str
            Registry key
        zMicrosoft SDKsrr&rrr�
microsoft_sdk�rGzRegistryInfo.microsoft_sdkcCrH)z�
        Microsoft Windows/Platform SDK registry key.

        Return
        ------
        str
            Registry key
        r�rIrJrKrRr&rrr�windows_sdkrMzRegistryInfo.windows_sdkcCrH)z�
        Microsoft .NET Framework SDK registry key.

        Return
        ------
        str
            Registry key
        ZNETFXSDKrSr&rrr�	netfx_sdk
rMzRegistryInfo.netfx_sdkcCrE)z�
        Microsoft Windows Kits Roots registry key.

        Return
        ------
        str
            Registry key
        zWindows Kits\Installed Rootsrr&rrr�windows_kits_rootsrGzRegistryInfo.windows_kits_rootsF�keyr*r(cC�dSrCr�r"rWr*rrr�	microsoft%�zRegistryInfo.microsoftrcCrXrCrrYrrrrZ'r[cCs(|j��s|r	dnd}tj�d|d|�S)a
        Return key in Microsoft software registry.

        Parameters
        ----------
        key: str
            Registry key path where look.
        x86: bool
            Force x86 software registry.

        Return
        ------
        str
            Registry key
        rZWow6432NodeZSoftware�	Microsoft)rDr0rIrJrK)r"rWr*Znode64rrrrZ)s�name�
str | Nonec	Cs�tj}tj}tj}|j}|jD]f}d}z||||�d|�}Wn'tyE|j��sAz||||d�d|�}Wnty@YYqwYqYnwz'zt�	||�dWW|rZ||�SStyeYnwW|rm||�q|ru||�wwdS)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 | None
            value
        NrT)
r�KEY_READ�OpenKeyZCloseKeyrZ�HKEYS�OSErrorrDr0�QueryValueEx)	r"rWr]Zkey_readZopenkeyZclosekey�ms�hkey�bkeyrrr�lookup<sD

��������
�zRegistryInfo.lookupN)rBrrr)rr
r=)rWr
r*r(rr
)rWrr*r(rr)rWrr]rrr^)rrrr>rrrrrrar#r@rFrLrOrPrQrRrTrUrVrrZrgrrrrrA�s@
�
rAc@sfeZdZdZe�dd�Ze�dd�Ze�de�Z	dFdGd
d�Z	dd�Z
dHdd�ZdIdd�Ze
dd��ZedJdd��ZedJdd��Zdd�Zd d!�ZedKd#d$��ZedJd%d&��ZedJd'd(��ZedLd*d+��ZedJd,d-��ZedLd.d/��ZedJd0d1��ZedKd2d3��ZedLd4d5��ZedJd6d7��ZedJd8d9��ZedMd;d<��ZedMd=d>��Z dMd?d@�Z!e
dNdOdDdE��Z"dS)P�
SystemInfoz�
    Microsoft Windows and Visual Studio related system information.

    Parameters
    ----------
    registry_info: RegistryInfo
        "RegistryInfo" instance.
    vc_ver: float
        Required Microsoft Visual C++ version.
    �WinDirr�ProgramFileszProgramFiles(x86)N�
registry_inforA�vc_ver�float | NonerrcCs2||_|jj|_|��|_|p|��|_|_dSrC)�rirD�find_programdata_vs_vers�known_vs_paths�_find_latest_available_vs_ver�vs_verrl)r"rkrlrrrr#xs

zSystemInfo.__init__cCs:|��}|s|jstj�d��t|�}|�|j�t|�S)zm
        Find the latest VC version

        Return
        ------
        float
            version
        z%No Microsoft Visual C++ version found)�find_reg_vs_versrp�	distutils�errors�DistutilsPlatformError�set�update�max)r"Zreg_vc_versZvc_versrrrrq�s	
�z(SystemInfo._find_latest_available_vs_ver�list[float]cCs^|jj}|jj|jj|jjf}g}t�|jj|�D]�\}}z
t�	|||�dtj
�}Wn	ty3Yqw|�lt�|�\}}}	t
|�D]*}
t�t��tt�||
�d�}||vr^|�|�Wd�n1shwYqCt
|�D](}
t�t��tt�||
��}||vr�|�|�Wd�n1s�wYqrWd�n1s�wYqt|�S)z�
        Find Microsoft Visual Studio versions available in registry.

        Return
        ------
        list of float
            Versions
        rN)rnrZrOrQrP�	itertools�productrarr`r_rbZQueryInfoKey�range�
contextlib�suppress�
ValueError�floatZ	EnumValue�appendZEnumKey�sorted)r"rdZvckeysZvs_versrerWrfZsubkeys�valuesr$�i�verrrrrs�s>	�
���
������zSystemInfo.find_reg_vs_vers�dict[float, str]c	
Cs�i}d}zt�|�}Wnty|YSw|D]J}z=tj�||d�}t|ddd��
}t�|�}Wd�n1s;wY|d}t�tj�|d��|||�|d	�<Wqtt	fycYqw|S)
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.jsonZrtzutf-8)�encodingNZinstallationPath�
VC\Tools\MSVCZinstallationVersion)
rI�listdirrbrJrK�open�json�load�_as_float_version�KeyError)	r"Zvs_versionsZ
instances_dirZhashed_namesr]Z
state_pathZ
state_file�stateZvs_pathrrrro�s*
����z#SystemInfo.find_programdata_vs_verscCstd�|�d�dd���S)z�
        Return a string version as a simplified float version (major.minor)

        Parameters
        ----------
        version: str
            Version.

        Return
        ------
        float
            version
        �.N�)r�rK�split)�versionrrrr��szSystemInfo._as_float_versionrcCs6tj�|jd|jd���}|j�|jj|jd��p|S)zp
        Microsoft Visual Studio directory.

        Return
        ------
        str
            path
        �Microsoft Visual Studio �0.1f)rIrJrK�ProgramFilesx86rrrnrgrP)r"�defaultrrr�VSInstallDir�s�zSystemInfo.VSInstallDircCs0|��p|��}tj�|�sd}tj�|��|S)zm
        Microsoft Visual C++ directory.

        Return
        ------
        str
            path
        z(Microsoft Visual C++ directory not found)�	_guess_vc�_guess_vc_legacyrIrJ�isdirrtrurv)r"rJ�msgrrr�VCInstallDirs

zSystemInfo.VCInstallDirc	Cs�|jdkrdSz|j|j}Wnty|j}Ynwtj�|d�}zt�|�d}|�|�|_	tj�||�WSt
tfyDYdSw)zl
        Locate Visual C++ for VS2017+.

        Return
        ------
        str
            path
        �,@rr����)rrrpr�r�rIrJrKr�r�rlrb�
IndexError)r"Zvs_dirZguess_vcrlrrrr�s
	
��zSystemInfo._guess_vccCsttj�|jd|jd�d��}tj�|jj|jd��}|j�|d�}|r*tj�|d�n|}|j�|jj|jd��p9|S)z{
        Locate Visual C++ for versions prior to 2017.

        Return
        ------
        str
            path
        r�r�z\VC�
installdirZVC)	rIrJrKr�rrrnrQrgrO)r"r�Zreg_pathZ	python_vcZ
default_vcrrrr�3s	�zSystemInfo._guess_vc_legacy�tuple[LiteralString, ...]cCsJ|jdkrdS|jdkrdS|jdkrdS|jdkrdS|jd	kr#d
SdS)z�
        Microsoft Windows SDK versions for specified MSVC++ version.

        Return
        ------
        tuple of str
            versions
        �"@)z7.0z6.1z6.0a�$@)z7.1z7.0a�&@)z8.0z8.0a�(@)�8.1z8.1ar�)z10.0r�r�rrr&rrr�WindowsSdkVersionIs





zSystemInfo.WindowsSdkVersioncCs|�tj�|jd��S)zt
        Microsoft Windows SDK last version.

        Return
        ------
        str
            version
        �lib)�_use_last_dir_namerIrJrK�
WindowsSdkDirr&rrr�WindowsSdkLastVersion_s
z SystemInfo.WindowsSdkLastVersioncCs<d}|jD]}tj�|jjd|���}|j�|d�}|rnq|r'tj�|�sCtj�|jj|j	d��}|j�|d�}|rCtj�|d�}|rKtj�|�so|jD] }|d|�
d��}d	|��}tj�|j|�}tj�|�rn|}qN|rwtj�|�s�|jD]}d
|��}tj�|j|�}tj�|�r�|}qz|s�tj�|jd�}|S)zn
        Microsoft Windows SDK directory.

        Return
        ------
        str
            path
        r�v�installationfolderr�r�ZWinSDKNr�zMicrosoft SDKs\Windows Kits\zMicrosoft SDKs\Windows\vZPlatformSDK)
r�rIrJrKrnrTrgr�rQrl�rfindrjr�)r"�sdkdirr��locrJZinstall_baseZintver�drrrr�ks<

�

�

�zSystemInfo.WindowsSdkDirr^c	Cs�|jdkr
d}d}nd}|jdkrdnd}|jjd|d��d	d
�}d|�d|��}g}|jd
krC|jD]}|tj�|jj	||�g7}q3|j
D]}|tj�|jjd|�d�|�g7}qF|D]}|j�|d�}|rk|Sq\dS)z�
        Microsoft Windows SDK executable directory.

        Return
        ------
        str | None
            path
        r��#r�(r�TF)rr5r3�-zWinSDK-NetFxZToolsr�r��Ar�N)
rrrDr6r!�NetFxSdkVersionrIrJrKrnrUr�rTrg)	r"Znetfxverrr5ZfxZregpathsr�rJZexecpathrrr�WindowsSDKExecutablePath�s&



$�z#SystemInfo.WindowsSDKExecutablePathcCs.tj�|jj|jd�d��}|j�|d�pdS)zl
        Microsoft Visual F# directory.

        Return
        ------
        str
            path
        r�z	\Setup\F#Z
productdirr)rIrJrKrnrFrrrg)r"rJrrr�FSharpInstallDir�s
zSystemInfo.FSharpInstallDircCsD|jdkrdnd}|D]}|j�|jjd|���}|r|SqdS)z{
        Microsoft Universal CRT SDK directory.

        Return
        ------
        str | None
            path
        r�)�10Z81rZkitsrootN)rrrnrgrV)r"�versr�r�rrr�UniversalCRTSdkDir�s�zSystemInfo.UniversalCRTSdkDirc
Cs@z|�tj�|jd��WSty}zt�|d��d}~ww)z�
        Microsoft Universal C Runtime SDK last version.

        Return
        ------
        str
            version
        r��Cannot find UniversalCRTSdkDirN)r�rIrJrKr��	TypeErrorr	�add_note)r"�exrrr�UniversalCRTSdkLastVersion�s
��z%SystemInfo.UniversalCRTSdkLastVersioncCs|jdkrdSdS)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�r&rrrr��s


���zSystemInfo.NetFxSdkVersioncCs>d}|jD]}tj�|jj|�}|j�|d�}|r|Sq|S)z|
        Microsoft .NET Framework SDK directory.

        Return
        ------
        str | None
            path
        rZkitsinstallationfolder)r�rIrJrKrnrUrg)r"r�r�r�rrr�NetFxSdkDir�s

�zSystemInfo.NetFxSdkDircC�&tj�|jd�}|j�|jjd�p|S)zw
        Microsoft .NET Framework 32bit directory.

        Return
        ------
        str
            path
        zMicrosoft.NET\FrameworkZframeworkdir32�rIrJrKrirnrgrO�r"Zguess_fwrrr�FrameworkDir32�zSystemInfo.FrameworkDir32cCr�)zw
        Microsoft .NET Framework 64bit directory.

        Return
        ------
        str
            path
        zMicrosoft.NET\Framework64Zframeworkdir64r�r�rrr�FrameworkDir64 r�zSystemInfo.FrameworkDir64�tuple[str, ...]cC�
|�d�S)z�
        Microsoft .NET Framework 32bit versions.

        Return
        ------
        tuple of str
            versions
        � ��_find_dot_net_versionsr&rrr�FrameworkVersion320�

zSystemInfo.FrameworkVersion32cCr�)z�
        Microsoft .NET Framework 64bit versions.

        Return
        ------
        tuple of str
            versions
        �@r�r&rrr�FrameworkVersion64<r�zSystemInfo.FrameworkVersion64cCs�|j�|jjd|���}t|d|���}|p|�|d�pd}|jdkr'|dfS|jdkr>|��dd	�d
kr:ddfS|dfS|jd
krEdS|jdkrLdSdS)z�
        Find Microsoft .NET Framework versions.

        Parameters
        ----------
        bits: int
            Platform number of bits: 32 or 64.

        Return
        ------
        tuple of str
            versions
        ZframeworkverZFrameworkDirr�rr�zv4.0r�Nr�Zv4z
v4.0.30319�v3.5r�)r��
v2.0.50727g @)zv3.0r�r)rnrgrO�getattrr�rrr )r"�bitsZreg_verZdot_net_dirr�rrrr�Hs

$

z!SystemInfo._find_dot_net_versionsrJr�prefixcs(��fdd�tt����D�}t|d�S)a-
        Return name of the last dir in path or '' if no dir found.

        Parameters
        ----------
        path: StrPath
            Use dirs in this path
        prefix: str
            Use only dirs starting by this prefix

        Return
        ------
        str
            name
        c3s4�|]}tj�tj��|��r|���r|VqdSrC)rIrJr�rK�
startswith)�.0Zdir_name�rJr�rr�	<genexpr>ws���
�z0SystemInfo._use_last_dir_name.<locals>.<genexpr>r)�reversedrIr��next)rJr�Z
matching_dirsrr�rr�fs�
zSystemInfo._use_last_dir_namerC)rkrArlrmrr)rrz)rr�r<)rr��rr^)rr�)r)rJrr�rrr)#rrrr>r
r?rirjr�r#rqrsro�staticmethodr�r@r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�rrrrrhfs^
�

*
*$
rhc@s6eZdZUded<ded<ded<ded<ded<dS)	�_EnvironmentDictr�includer��libpathrJzNotRequired[str | None]�py_vcruntime_redistN)rrr�__annotations__rrrrr��s
r�c@sbeZdZdZdEdFdd�Zedd	��Zed
d��Zedd
��Zedd��Z	edd��Z
edd��Zedd��Zedd��Z
edd��Zedd��Zedd��Zdd�ZedGd!d"��Zed#d$��Zed%d&��Zed'd(��Zed)d*��Zed+d,��Zed-d.��Zed/d0��ZedHd2d3��ZedHd4d5��ZedGd6d7��Zed8d9��ZedId;d<��ZdJdKdAdB�ZdCdD�Z dS)L�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.
    NrrrcCsBt|�|_t|j�|_t|j|�|_|j|krd}tj�	|��dS)Nz.No suitable Microsoft Visual C++ version found)
rrDrArnrh�sirlrtrurv)r"rrlZ
vc_min_ver�errrrrr#�s

�zEnvironmentInfo.__init__cC�|jjS)zk
        Microsoft Visual Studio.

        Return
        ------
        float
            version
        )r�rrr&rrrrr��
zEnvironmentInfo.vs_vercCr�)zp
        Microsoft Visual C++ version.

        Return
        ------
        float
            version
        )r�rlr&rrrrl�r�zEnvironmentInfo.vc_vercsXddg}�jdkr#�jjddd�}|dg7}|dg7}|d|��g7}�fdd	�|D�S)
zu
        Microsoft Visual Studio Tools.

        Return
        ------
        list of str
            paths
        zCommon7\IDEz
Common7\Toolsr�T�r5rz1Common7\IDE\CommonExtensions\Microsoft\TestWindowzTeam Tools\Performance Toolsc�g|]}tj��jj|��qSr�rIrJrKr�r��r�rJr&rr�
<listcomp>��z+EnvironmentInfo.VSTools.<locals>.<listcomp>)rrrDr6)r"�paths�arch_subdirrr&r�VSTools�s



zEnvironmentInfo.VSToolscCs$tj�|jjd�tj�|jjd�gS)z�
        Microsoft Visual C++ & Microsoft Foundation Class Includes.

        Return
        ------
        list of str
            paths
        ZIncludezATLMFC\Include�rIrJrKr�r�r&rrr�
VCIncludes�s�zEnvironmentInfo.VCIncludescsh�jdkr
�jjdd�}n�jjdd�}d|��d|��g}�jdkr+|d|��g7}�fd	d
�|D�S)z�
        Microsoft Visual C++ & Microsoft Foundation Class Libraries.

        Return
        ------
        list of str
            paths
        �.@T�r�r5�Libz
ATLMFC\Libr�z	Lib\storecr�rr�r�r&rrr��r�z/EnvironmentInfo.VCLibraries.<locals>.<listcomp>)rrrDr8)r"r�r�rr&r�VCLibraries�s


zEnvironmentInfo.VCLibrariescC�"|jdkrgStj�|jjd�gS)z�
        Microsoft Visual C++ store references Libraries.

        Return
        ------
        list of str
            paths
        r�zLib\store\references)rrrIrJrKr�r�r&rrr�VCStoreRefs�s

zEnvironmentInfo.VCStoreRefscCs8|j}tj�|jd�g}|jdkrdnd}|j�|�}|r+|tj�|jd|���g7}|jdkrGd|jjdd���}|tj�|j|�g7}|S|jdkr�|jj	�
d	d
���}tj�dd|�d
��}|tj�|j||jjdd��g7}|jj	|jj
kr�|tj�|j||jjdd��g7}|S|tj�|jd�g7}|S)a�
        Microsoft Visual C++ Tools.

        Return
        ------
        list of str
            paths

        When host CPU is ARM, the tools should be found for ARM.

        >>> getfixture('windows_only')
        >>> mp = getfixture('monkeypatch')
        >>> mp.setattr(PlatformInfo, 'current_cpu', 'arm64')
        >>> ei = EnvironmentInfo(arch='irrelevant')
        >>> paths = ei.VCTools
        >>> any('HostARM64' in path for path in paths)
        True
        Z
VCPackagesr�TF�Binr�r�r�rr�bin�Hostz%sr�)r�rIrJrKr�rrrDr;r6r/r!�upperr8r')r"r��toolsr9r�rJZhost_idZhost_dirrrr�VCToolss2

����	�zEnvironmentInfo.VCToolscCst|jdkr|jjddd�}tj�|jjd|���gS|jjdd�}tj�|jjd�}|j}tj�||�d|���gS)zw
        Microsoft Windows SDK Libraries.

        Return
        ------
        list of str
            paths
        r�Tr�r�r�r��um)	rrrDr8rIrJrKr�r��_sdk_subdir)r"r�r�Zlibverrrr�OSLibraries:s

zEnvironmentInfo.OSLibrariescCs~tj�|jjd�}|jdkr|tj�|d�gS|jdkr |j}nd}tj�||�d��tj�||�d��tj�||�d��gS)	zu
        Microsoft Windows SDK Include.

        Return
        ------
        list of str
            paths
        r�r��glr�rZsharedrZwinrt)rIrJrKr�r�rrr)r"r��sdkverrrr�
OSIncludesNs


�zEnvironmentInfo.OSIncludescCs�tj�|jjd�}g}|jdkr||j7}|jdkr$|tj�|d�g7}|jdkr[||tj�|jjd�tj�|dd�tj�|d	d�tj�|d
d�tj�|jjdd|jd
�ddd�g7}|S)z}
        Microsoft Windows SDK Libraries Paths.

        Return
        ------
        list of str
            paths
        Z
Referencesr�r�zCommonConfiguration\Neutralr�Z
UnionMetadataz'Windows.Foundation.UniversalApiContractz1.0.0.0z%Windows.Foundation.FoundationContractz,Windows.Networking.Connectivity.WwanContractZ
ExtensionSDKszMicrosoft.VCLibsr�ZCommonConfigurationZneutral)rIrJrKr�r�rrr)r"�refr�rrr�	OSLibpathhs4




���zEnvironmentInfo.OSLibpathcCst|���S)zs
        Microsoft Windows SDK Tools.

        Return
        ------
        list of str
            paths
        )�list�
_sdk_toolsr&rrr�SdkTools�s
zEnvironmentInfo.SdkToolsccs�|jdkr|jdkr
dnd}tj�|jj|�V|j��s4|jjdd�}d|��}tj�|jj|�V|jdvrY|j�	�rAd}n|jjddd	�}d
|��}tj�|jj|�Vn%|jdkr~tj�|jjd�}|jjdd�}|jj
}tj�||�|���V|jjr�|jjVdSdS)z�
        Microsoft Windows SDK Tools paths generator.

        Return
        ------
        generator of str
            paths
        r�r�r�zBin\x86Tr�)r�r�rr�zBin\NETFX 4.0 ToolsN)rrrIrJrKr�r�rDr0r6r,r�r�)r"Zbin_dirr�rJrrrrr�s,�
	





�zEnvironmentInfo._sdk_toolsrcC�|jj}|r|�d�SdS)zu
        Microsoft Windows SDK version subdir.

        Return
        ------
        str
            subdir
        r3r)r�r��r"�ucrtverrrrr��
zEnvironmentInfo._sdk_subdircCs"|jdkrgStj�|jjd�gS)zs
        Microsoft Windows SDK Setup.

        Return
        ------
        list of str
            paths
        r�ZSetup)rrrIrJrKr�r�r&rrr�SdkSetup��

zEnvironmentInfo.SdkSetupcs�|j}|j�|jdkrd}|��o|��}n|��p|��}|jdkp)|jdk}g}|r:|�fdd��jD�7}|rH|�fdd��jD�7}|S)zv
        Microsoft .NET Framework Tools.

        Return
        ------
        list of str
            paths
        r�Trc�g|]
}tj��j|��qSr)rIrJrKr��r�r��r�rrr����z+EnvironmentInfo.FxTools.<locals>.<listcomp>crr)rIrJrKr�rrrrr��r)	rDr�rrr,r0r/r'r�r�)r"rDZ	include32Z	include64rrrr�FxTools�s"

��zEnvironmentInfo.FxToolscCs>|jdks	|jjsgS|jjdd�}tj�|jjd|���gS)z~
        Microsoft .Net Framework SDK Libraries.

        Return
        ------
        list of str
            paths
        r�Tr�zlib\um)rrr�r�rDr8rIrJrK)r"r�rrr�NetFxSDKLibraries�s
z!EnvironmentInfo.NetFxSDKLibrariescCs*|jdks	|jjsgStj�|jjd�gS)z}
        Microsoft .Net Framework SDK Includes.

        Return
        ------
        list of str
            paths
        r�z
include\um)rrr�r�rIrJrKr&rrr�NetFxSDKIncludes
s
z EnvironmentInfo.NetFxSDKIncludescCstj�|jjd�gS)z�
        Microsoft Visual Studio Team System Database.

        Return
        ------
        list of str
            paths
        z
VSTSDB\Deployr�r&rrr�VsTDbs
zEnvironmentInfo.VsTDbcCs�|jdkrgS|jdkr|jj}|jjdd�}n|jj}d}d|jd�d|��}tj�||�g}|jdkr@|tj�||d	�g7}|S)
zn
        Microsoft Build Engine.

        Return
        ------
        list of str
            paths
        r�r�Tr�rzMSBuild\r�z\binZRoslyn)	rrr�r�rDr6r�rIrJrK)r"�	base_pathr�rJ�buildrrr�MSBuild%s



zEnvironmentInfo.MSBuildcCr�)zt
        Microsoft HTML Help Workshop.

        Return
        ------
        list of str
            paths
        r�zHTML Help Workshop)rrrIrJrKr�r�r&rrr�HTMLHelpWorkshopArz EnvironmentInfo.HTMLHelpWorkshop�	list[str]c
Csz|jdkrgS|jjdd�}ztj�|jjd�}Wnty,}zt	�
|d��d}~ww|j}tj�||�d|���gS)z�
        Microsoft Universal C Runtime SDK Libraries.

        Return
        ------
        list of str
            paths
        r�Tr�r�r�N�ucrt)rrrDr8rIrJrKr�r�r�r	r��_ucrt_subdir)r"r�r�r�rrrr�
UCRTLibrariesPs

��zEnvironmentInfo.UCRTLibrariesc
Csd|jdkrgSztj�|jjd�}Wnty%}zt�|d��d}~wwtj�||j	�d��gS)z�
        Microsoft Universal C Runtime SDK Include.

        Return
        ------
        list of str
            paths
        r�r�r�Nr!)
rrrIrJrKr�r�r�r	r�r")r"r�r�rrr�UCRTIncludesfs

��zEnvironmentInfo.UCRTIncludescCr)z�
        Microsoft Universal C Runtime SDK version subdir.

        Return
        ------
        str
            subdir
        r3r)r�r�rrrrr"zrzEnvironmentInfo._ucrt_subdircCs$d|jkrdkr
gS|jjgS)zk
        Microsoft Visual F#.

        Return
        ------
        list of str
            paths
        r�r�)rrr�r�r&rrr�FSharp�s
�
zEnvironmentInfo.FSharpr^cs�d|j�d��|jjdd��d��g}|jj}tj�|�	dd��}tj�
|�r>tj�|t�|�d�}||tj�|d	�g7}|tj�|d
�g7}d|jd�d
�dt
|j�d�d
�f}��fdd�t�||�D�}tttjj|�d�S)z{
        Microsoft Visual C++ runtime redistributable dll.

        Returns the first suitable path found or None.
        �	vcruntimez0.dllTr�r3z\Toolsz\Redistr�ZonecoreZredistzMicrosoft.VC�
z.CRTc3s&�|]\}}tj�|�|��VqdSrC)rIrJrK)r�r�Zcrt_dir�r�r&rrr��s
��
�z2EnvironmentInfo.VCRuntimeRedist.<locals>.<genexpr>N)rlrDr8�stripr�r�rIrJ�dirnamer!r�rKr��intrrr{r|r��filter�isfile)r"�prefixesZ
tools_pathZredist_pathZcrt_dirsZcandidate_pathsrr(r�VCRuntimeRedist�s �
�zEnvironmentInfo.VCRuntimeRedistT�existsr(r�cCs�t|�d|j|j|j|jg|�|�d|j|j|j|j	|j
g|�|�d|j|j|j|jg|�|�d|j
|j|j|j|j|j|j|j|jg	|�d�}|jdkrU|jrU|j|d<|S)z�
        Return environment dict.

        Parameters
        ----------
        exists: bool
            It True, only return existing paths.

        Return
        ------
        dict
            environment
        r�r�r�rJ)r�r�r�rJ�r�)r��_build_pathsr�rr$rr�rrr#rr�r
rr�rr
rrrr%rrr/)r"r0�envrrr�
return_env�sV��
������+
zEnvironmentInfo.return_envc
Csxtj�|�}t�|d��tj�}t�||�}|r!tt	tj
j|��n|}|s2|���d�}t
j�|��t|�}	tj�|	�S)aC
        Given an environment variable name and specified paths,
        return a pathsep-separated string of paths containing
        unique, extant, directories from those paths and from
        the environment variable. Raise an error if no paths
        are resolved.

        Parameters
        ----------
        name: str
            Environment variable name
        spec_path_lists: list of str
            Paths
        exists: bool
            It True, only return existing paths.

        Return
        ------
        str
            Pathsep-separated paths
        rz environment variable is empty)r{�chain�
from_iterabler
r?r�rI�pathseprr,rJr�rrtrurvrrK)
r"r]Zspec_path_listsr0Z
spec_pathsZ	env_pathsr�Zextant_pathsr�Zunique_pathsrrrr2�szEnvironmentInfo._build_paths)Nr)rrr<)rr r�)T)r0r(rr�)!rrrr>r#r@rrrlr�r�r�r�rrrr
r
rrrrrrrrrr#r$r"r%r/r4r2rrrrr��sl	






2


'
#







"=r�)"r>�
__future__rr~r{r�rIZos.path�platform�typingrrrZmore_itertoolsr�_pathr�compatr	Zdistutils.errorsrtZtyping_extensionsr
r�systemrr
�dictr�rrArhr�r�rrrr�<module>s<yB