Your IP : 52.15.111.109


Current Path : /usr/lib/python3.8/site-packages/setuptools/__pycache__/
Upload File :
Current File : //usr/lib/python3.8/site-packages/setuptools/__pycache__/msvc.cpython-38.pyc

U

�Qab���@sXdZddlZddlmZddlmZmZddlmZm	Z	m
Z
mZddlZddl
Z
ddlZddlZddlmZddlmZdd	lmZe
��d
kr�ddlmZddlmZnGd
d�d�Ze�ZeejjfZzddlm Z Wnek
r�YnXdd�Z!d$dd�Z"dd�Z#dd�Z$d%dd�Z%Gdd�d�Z&Gdd�d�Z'Gd d!�d!�Z(Gd"d#�d#�Z)dS)&a�
Improved support for Microsoft Visual C++ compilers.

Known supported compilers:
--------------------------
Microsoft Visual C++ 9.0:
    Microsoft Visual C++ Compiler for Python 2.7 (x86, amd64)
    Microsoft Windows SDK 6.1 (x86, x64, ia64)
    Microsoft Windows SDK 7.0 (x86, x64, ia64)

Microsoft Visual C++ 10.0:
    Microsoft Windows SDK 7.1 (x86, x64, ia64)

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)�listdir�pathsep)�join�isfile�isdir�dirname)�
LegacyVersion)�filterfalse�)�
get_unpatched�Windows)�winreg)�environc@seZdZdZdZdZdZdS)rN)�__name__�
__module__�__qualname__�
HKEY_USERS�HKEY_CURRENT_USER�HKEY_LOCAL_MACHINE�HKEY_CLASSES_ROOT�rr�3/usr/lib/python3.8/site-packages/setuptools/msvc.pyr*sr)�RegcCs�d}|d|f}zt�|d�}WnJtk
rjz|d|f}t�|d�}Wntk
rdd}YnXYnX|r�t|d�}t|�r�|Stt�|�S)a�
    Patched "distutils.msvc9compiler.find_vcvarsall" to use the standalone
    compiler build for Python
    (VCForPython / Microsoft Visual C++ Compiler for Python 2.7).

    Fall back to original behavior when the standalone compiler is not
    available.

    Redirect the path of "vcvarsall.bat".

    Parameters
    ----------
    version: float
        Required Microsoft Visual C++ version.

    Return
    ------
    str
        vcvarsall.bat path
    z-Software\%sMicrosoft\DevDiv\VCForPython\%0.1f��
installdirzWow6432Node\Nz
vcvarsall.bat)rZ	get_value�KeyErrorrrr�msvc9_find_vcvarsall)�versionZvc_base�key�
productdir�	vcvarsallrrrrAs
r�x86c
Os�ztt�}|||f|�|�WStjjk
r4Yntk
rFYnXzt||���WStjjk
r�}zt|||��W5d}~XYnXdS)ao
    Patched "distutils.msvc9compiler.query_vcvarsall" for support extra
    Microsoft Visual C++ 9.0 and 10.0 compilers.

    Set environment without use of "vcvarsall.bat".

    Parameters
    ----------
    ver: float
        Required Microsoft Visual C++ version.
    arch: str
        Target architecture.

    Return
    ------
    dict
        environment
    N)	r�msvc9_query_vcvarsall�	distutils�errors�DistutilsPlatformError�
ValueError�EnvironmentInfo�
return_env�_augment_exception)�ver�arch�args�kwargsZorig�excrrrr#ksr#c
Csrztt�|�WStjjk
r&YnXzt|dd���WStjjk
rl}zt|d��W5d}~XYnXdS)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
    �,@)�
vc_min_verN)r�msvc14_get_vc_envr$r%r&r(r)r*)Z	plat_specr/rrrr2�s
r2cOsBdtjkr4ddl}t|j�td�kr4|jjj||�Stt	�||�S)z�
    Patched "distutils._msvccompiler.gen_lib_options" for fix
    compatibility between "numpy.distutils" and "distutils._msvccompiler"
    (for Numpy < 1.11.2)
    znumpy.distutilsrNz1.11.2)
�sys�modulesZnumpyr	�__version__r$Z	ccompilerZgen_lib_optionsr�msvc14_gen_lib_options)r-r.Znprrrr6�s

r6rcCs�|jd}d|��ks"d|��kr�d}|jft��}d}|dkrf|���d�dkr\|d	7}q�|d
7}n.|dkr�|d7}||d
7}n|dkr�|d7}|f|_dS)zl
    Add details to the exception message to help guide the user
    as to what action will resolve it.
    rr!zvisual cz0Microsoft Visual C++ {version:0.1f} is required.z-www.microsoft.com/download/details.aspx?id=%d�"@Zia64���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 r0z[ Get it with "Build Tools for Visual Studio": https://visualstudio.microsoft.com/downloads/N)r-�lower�format�locals�find)r/rr,�messageZtmplZ
msdownloadrrrr*�s


r*c@sbeZdZdZe�dd���Zdd�Ze	dd��Z
dd	�Zd
d�Zdd
d�Z
ddd�Zddd�ZdS)�PlatformInfoz�
    Current and Target Architectures information.

    Parameters
    ----------
    arch: str
        Target architecture.
    Zprocessor_architecturercCs|���dd�|_dS)N�x64�amd64)r:�replacer,)�selfr,rrr�__init__�szPlatformInfo.__init__cCs|j|j�d�dd�S)zs
        Return Target CPU architecture.

        Return
        ------
        str
            Target CPU
        �_rN)r,r=�rCrrr�
target_cpu�s
zPlatformInfo.target_cpucCs
|jdkS)z�
        Return True if target CPU is x86 32 bits..

        Return
        ------
        bool
            CPU is x86 32 bits
        r"�rGrFrrr�
target_is_x86�s	zPlatformInfo.target_is_x86cCs
|jdkS)z�
        Return True if current CPU is x86 32 bits..

        Return
        ------
        bool
            CPU is x86 32 bits
        r"��current_cpurFrrr�current_is_x86s	zPlatformInfo.current_is_x86FcCs.|jdkr|rdS|jdkr$|r$dSd|jS)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"rrA�\x64�\%srJ�rC�hidex86r@rrr�current_dirs�zPlatformInfo.current_dircCs.|jdkr|rdS|jdkr$|r$dSd|jS)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"rrArMrNrHrOrrr�
target_dir(s�zPlatformInfo.target_dircCs0|rdn|j}|j|krdS|���dd|�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"r�\z\%s_)rKrGrRrB)rC�forcex86Zcurrentrrr�	cross_dir>s�zPlatformInfo.cross_dirN)FF)FF)F)rrr�__doc__r�getr:rKrD�propertyrGrIrLrQrRrUrrrrr?�s


r?c@s�eZdZdZejejejejfZ	dd�Z
edd��Zedd��Z
edd	��Zed
d��Zedd
��Zedd��Zedd��Zedd��Zedd��Zddd�Zdd�ZdS)�RegistryInfoz�
    Microsoft Visual Studio related registry information.

    Parameters
    ----------
    platform_info: PlatformInfo
        "PlatformInfo" instance.
    cCs
||_dS�N)�pi)rCZ
platform_inforrrrDcszRegistryInfo.__init__cCsdS)z�
        Microsoft Visual Studio root registry key.

        Return
        ------
        str
            Registry key
        ZVisualStudiorrFrrr�visualstudiofs
zRegistryInfo.visualstudiocCst|jd�S)z
        Microsoft Visual Studio SxS registry key.

        Return
        ------
        str
            Registry key
        ZSxS)rr\rFrrr�sxsrs
zRegistryInfo.sxscCst|jd�S)z|
        Microsoft Visual C++ VC7 registry key.

        Return
        ------
        str
            Registry key
        ZVC7�rr]rFrrr�vc~s
zRegistryInfo.vccCst|jd�S)z
        Microsoft Visual Studio VS7 registry key.

        Return
        ------
        str
            Registry key
        ZVS7r^rFrrr�vs�s
zRegistryInfo.vscCsdS)z�
        Microsoft Visual C++ for Python registry key.

        Return
        ------
        str
            Registry key
        zDevDiv\VCForPythonrrFrrr�
vc_for_python�s
zRegistryInfo.vc_for_pythoncCsdS)zq
        Microsoft SDK registry key.

        Return
        ------
        str
            Registry key
        zMicrosoft SDKsrrFrrr�
microsoft_sdk�s
zRegistryInfo.microsoft_sdkcCst|jd�S)z�
        Microsoft Windows/Platform SDK registry key.

        Return
        ------
        str
            Registry key
        r
�rrbrFrrr�windows_sdk�s
zRegistryInfo.windows_sdkcCst|jd�S)z�
        Microsoft .NET Framework SDK registry key.

        Return
        ------
        str
            Registry key
        ZNETFXSDKrcrFrrr�	netfx_sdk�s
zRegistryInfo.netfx_sdkcCsdS)z�
        Microsoft Windows Kits Roots registry key.

        Return
        ------
        str
            Registry key
        zWindows Kits\Installed RootsrrFrrr�windows_kits_roots�s
zRegistryInfo.windows_kits_rootsFcCs$|j��s|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
        rZWow6432NodeZSoftwareZ	Microsoft)r[rLr)rCrr"Znode64rrr�	microsoft�szRegistryInfo.microsoftc
Cs�tj}tj}|j}|jD]�}z||||�d|�}Wn`ttfk
r�|j��s�z||||d�d|�}Wq�ttfk
r�YYqYq�XnYqYnXzt�	||�dWSttfk
r�YqXqdS)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
        rTN)
r�KEY_READ�OpenKeyrg�HKEYS�OSError�IOErrorr[rLZQueryValueEx)rCr�nameZkey_readZopenkey�ms�hkey�bkeyrrr�lookup�s"


zRegistryInfo.lookupN)F)rrrrVrrrrrrjrDrXr\r]r_r`rarbrdrerfrgrqrrrrrYUs6�









rYc@s<eZdZdZe�dd�Ze�dd�Ze�de�Zd7dd�Z	d	d
�Z
dd�Zd
d�Ze
dd��Zedd��Zedd��Zdd�Zdd�Zedd��Zedd��Zedd��Zedd ��Zed!d"��Zed#d$��Zed%d&��Zed'd(��Zed)d*��Zed+d,��Zed-d.��Zed/d0��Zed1d2��Z d3d4�Z!e
d8d5d6��Z"dS)9�
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)NcCs2||_|jj|_|��|_|p$|��|_|_dSrZ)�rir[�find_programdata_vs_vers�known_vs_paths�_find_latest_available_vs_ver�vs_ver�vc_ver)rCZ
registry_inforzrrrrDs



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

        Return
        ------
        float
            version
        z%No Microsoft Visual C++ version foundr8)�find_reg_vs_versrwr$r%r&�set�update�sorted)rCZreg_vc_versZvc_versrrrrx%s	
�z(SystemInfo._find_latest_available_vs_vercCs$|jj}|jj|jj|jjf}g}|jjD]�}|D]�}zt�|||�dtj�}Wnt	t
fk
rlYq2YnXt�|�\}}}	t|�D]D}
z*t
t�||
�d�}||kr�|�|�Wq�tk
r�Yq�Xq�t|�D]B}
z&t
t�||
��}||kr�|�|�Wq�tk
�rYq�Xq�q2q*t|�S)z�
        Find Microsoft Visual Studio versions available in registry.

        Return
        ------
        list of float
            Versions
        r)rurgr_rar`rjrrirhrkrlZQueryInfoKey�range�floatZ	EnumValue�appendr'ZEnumKeyr~)rCrnZvckeysZvs_versrorrpZsubkeys�valuesrE�ir+rrrr{8s2	
zSystemInfo.find_reg_vs_versc	Cs�i}d}zt|�}Wnttfk
r0|YSX|D]�}z\t||d�}t|ddd��}t�|�}W5QRX|d}tt|d��|||�|d�<Wq6tttfk
r�Yq6Yq6Xq6|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)�encodingZinstallationPath�
VC\Tools\MSVCZinstallationVersion)	rrkrlrr�json�load�_as_float_versionr)	rCZvs_versionsZ
instances_dirZhashed_namesrmZ
state_pathZ
state_file�stateZvs_pathrrrrv[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�r�split)rrrrr��szSystemInfo._as_float_versioncCs.t|jd|j�}|j�|jjd|j�p,|S)zp
        Microsoft Visual Studio directory.

        Return
        ------
        str
            path
        zMicrosoft Visual Studio %0.1f�%0.1f)r�ProgramFilesx86ryrurqr`)rC�defaultrrr�VSInstallDir�s�zSystemInfo.VSInstallDircCs,|��p|��}t|�s(d}tj�|��|S)zm
        Microsoft Visual C++ directory.

        Return
        ------
        str
            path
        z(Microsoft Visual C++ directory not found)�	_guess_vc�_guess_vc_legacyrr$r%r&)rC�path�msgrrr�VCInstallDir�s

zSystemInfo.VCInstallDirc
Cs�|jdkrdSz|j|j}Wntk
r8|j}YnXt|d�}z$t|�d}|�|�|_t||�WStt	t
fk
r�YdSXdS)zl
        Locate Visual C++ for VS2017+.

        Return
        ------
        str
            path
        r0rr�r8N)ryrwrr�rrr�rzrkrl�
IndexError)rCZvs_dirZguess_vcrzrrrr��s	

zSystemInfo._guess_vccCsbt|jd|j�}t|jjd|j�}|j�|d�}|rBt|d�n|}|j�|jjd|j�p`|S)z{
        Locate Visual C++ for versions prior to 2017.

        Return
        ------
        str
            path
        z Microsoft Visual Studio %0.1f\VCr�rZVC)rr�ryrurarqr_)rCr�Zreg_pathZ	python_vcZ
default_vcrrrr��s	�zSystemInfo._guess_vc_legacycCsJ|jdkrdS|jdkrdS|jdkr*dS|jdkr8dS|jd	krFd
SdS)z�
        Microsoft Windows SDK versions for specified MSVC++ version.

        Return
        ------
        tuple of str
            versions
        r7)z7.0z6.1z6.0ar9)z7.1z7.0a�&@)z8.0z8.0a�(@)�8.1z8.1ar0)z10.0r�N�ryrFrrr�WindowsSdkVersion�s





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

        Return
        ------
        str
            version
        �lib)�_use_last_dir_namer�
WindowsSdkDirrFrrr�WindowsSdkLastVersions
z SystemInfo.WindowsSdkLastVersioncCsd}|jD],}t|jjd|�}|j�|d�}|r
q8q
|rDt|�stt|jjd|j�}|j�|d�}|rtt|d�}|r�t|�s�|jD]6}|d|�d��}d	|}t|j	|�}t|�r�|}q�|r�t|�s�|jD]$}d
|}t|j	|�}t|�r�|}q�|�st|j
d�}|S)zn
        Microsoft Windows SDK directory.

        Return
        ------
        str
            path
        rzv%s�installationfolderr�rZWinSDKNr�zMicrosoft SDKs\Windows Kits\%szMicrosoft SDKs\Windows\v%sZPlatformSDK)r�rrurdrqrrarz�rfindrtr�)rC�sdkdirr+�locr�Zinstall_baseZintver�drrrr�s6




zSystemInfo.WindowsSdkDirc	Cs�|jdkrd}d}n&d}|jdkr&dnd}|jjd|d�}d	||�d
d�f}g}|jdkr~|jD]}|t|jj||�g7}qb|jD]}|t|jj	d
||�g7}q�|D]}|j�
|d�}|r�|Sq�dS)zy
        Microsoft Windows SDK executable directory.

        Return
        ------
        str
            path
        r��#r�(r�TF)r@rPzWinSDK-NetFx%dTools%srS�-r0zv%sAr�N)ryr[rQrB�NetFxSdkVersionrrurer�rdrq)	rCZnetfxverr,rPZfxZregpathsr+r�Zexecpathrrr�WindowsSDKExecutablePath7s"



z#SystemInfo.WindowsSDKExecutablePathcCs&t|jjd|j�}|j�|d�p$dS)zl
        Microsoft Visual F# directory.

        Return
        ------
        str
            path
        z%0.1f\Setup\F#r r)rrur\ryrq)rCr�rrr�FSharpInstallDirZs
zSystemInfo.FSharpInstallDircCsF|jdkrdnd}|D]*}|j�|jjd|�}|r|p:dSqdS)zt
        Microsoft Universal CRT SDK directory.

        Return
        ------
        str
            path
        r0)Z10Z81rz
kitsroot%srN)ryrurqrf)rCZversr+r�rrr�UniversalCRTSdkDirgs�zSystemInfo.UniversalCRTSdkDircCs|�t|jd��S)z�
        Microsoft Universal C Runtime SDK last version.

        Return
        ------
        str
            version
        r�)r�rr�rFrrr�UniversalCRTSdkLastVersion{s
z%SystemInfo.UniversalCRTSdkLastVersioncCs|jdkrdSdS)z�
        Microsoft .NET Framework SDK versions.

        Return
        ------
        tuple of str
            versions
        r0)	z4.7.2z4.7.1z4.7z4.6.2z4.6.1z4.6z4.5.2z4.5.1z4.5rr�rFrrrr��s��zSystemInfo.NetFxSdkVersioncCs8d}|jD](}t|jj|�}|j�|d�}|r
q4q
|S)zu
        Microsoft .NET Framework SDK directory.

        Return
        ------
        str
            path
        rZkitsinstallationfolder)r�rrurerq)rCr�r+r�rrr�NetFxSdkDir�s

zSystemInfo.NetFxSdkDircCs"t|jd�}|j�|jjd�p |S)zw
        Microsoft .NET Framework 32bit directory.

        Return
        ------
        str
            path
        zMicrosoft.NET\FrameworkZframeworkdir32�rrsrurqr_�rCZguess_fwrrr�FrameworkDir32�szSystemInfo.FrameworkDir32cCs"t|jd�}|j�|jjd�p |S)zw
        Microsoft .NET Framework 64bit directory.

        Return
        ------
        str
            path
        zMicrosoft.NET\Framework64Zframeworkdir64r�r�rrr�FrameworkDir64�szSystemInfo.FrameworkDir64cCs
|�d�S)z�
        Microsoft .NET Framework 32bit versions.

        Return
        ------
        tuple of str
            versions
        � ��_find_dot_net_versionsrFrrr�FrameworkVersion32�s
zSystemInfo.FrameworkVersion32cCs
|�d�S)z�
        Microsoft .NET Framework 64bit versions.

        Return
        ------
        tuple of str
            versions
        �@r�rFrrr�FrameworkVersion64�s
zSystemInfo.FrameworkVersion64cCs�|j�|jjd|�}t|d|�}|p6|�|d�p6d}|jdkrJ|dfS|jdkrt|��dd	�d
krldn|dfS|jd
kr�dS|jdkr�dSdS)z�
        Find Microsoft .NET Framework versions.

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

        Return
        ------
        tuple of str
            versions
        zframeworkver%dzFrameworkDir%d�vrr�zv4.0r9Nr�Zv4z
v4.0.30319�v3.5r7)r��
v2.0.50727g @)zv3.0r�)rurqr_�getattrr�ryr:)rC�bitsZreg_verZdot_net_dirr+rrrr��s

 

z!SystemInfo._find_dot_net_versionscs*��fdd�tt���D�}t|d�p(dS)a)
        Return name of the last dir in path or '' if no dir found.

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

        Return
        ------
        str
            name
        c3s*|]"}tt�|��r|���r|VqdSrZ)rr�
startswith)�.0Zdir_name�r��prefixrr�	<genexpr>s
�z0SystemInfo._use_last_dir_name.<locals>.<genexpr>Nr)�reversedr�next)r�r�Z
matching_dirsrr�rr��s
�zSystemInfo._use_last_dir_name)N)r)#rrrrVrrWrsrtr�rDrxr{rv�staticmethodr�rXr�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�rrrrrr	sZ


#*





*
"








rrc@sbeZdZdZd?dd�Zedd��Zedd	��Zed
d��Zedd
��Z	edd��Z
edd��Zedd��Zedd��Z
edd��Zedd��Zedd��Zdd�Zedd��Zed d!��Zed"d#��Zed$d%��Zed&d'��Zed(d)��Zed*d+��Zed,d-��Zed.d/��Zed0d1��Zed2d3��Zed4d5��Zed6d7��Zd@d9d:�Zd;d<�Z e!dAd=d>��Z"dS)Br(aY
    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.
    NrcCsBt|�|_t|j�|_t|j|�|_|j|kr>d}tj�	|��dS)Nz.No suitable Microsoft Visual C++ version found)
r?r[rYrurr�sirzr$r%r&)rCr,rzr1�errrrrrD0s

zEnvironmentInfo.__init__cCs|jjS)zk
        Microsoft Visual Studio.

        Return
        ------
        float
            version
        )r�ryrFrrrry9s
zEnvironmentInfo.vs_vercCs|jjS)zp
        Microsoft Visual C++ version.

        Return
        ------
        float
            version
        )r�rzrFrrrrzEs
zEnvironmentInfo.vc_vercsVddg}�jdkrD�jjddd�}|dg7}|dg7}|d|g7}�fd	d
�|D�S)zu
        Microsoft Visual Studio Tools.

        Return
        ------
        list of str
            paths
        zCommon7\IDEz
Common7\Toolsr0T�rPr@z1Common7\IDE\CommonExtensions\Microsoft\TestWindowzTeam Tools\Performance ToolszTeam Tools\Performance Tools%scsg|]}t�jj|��qSr�rr�r��r�r�rFrr�
<listcomp>csz+EnvironmentInfo.VSTools.<locals>.<listcomp>)ryr[rQ)rC�paths�arch_subdirrrFr�VSToolsQs



zEnvironmentInfo.VSToolscCst|jjd�t|jjd�gS)z�
        Microsoft Visual C++ & Microsoft Foundation Class Includes.

        Return
        ------
        list of str
            paths
        ZIncludezATLMFC\Include�rr�r�rFrrr�
VCIncludeses
�zEnvironmentInfo.VCIncludescsb�jdkr�jjdd�}n�jjdd�}d|d|g}�jdkrP|d|g7}�fd	d
�|D�S)z�
        Microsoft Visual C++ & Microsoft Foundation Class Libraries.

        Return
        ------
        list of str
            paths
        �.@T�r@�rP�Lib%szATLMFC\Lib%sr0zLib\store%scsg|]}t�jj|��qSrr�r�rFrrr��sz/EnvironmentInfo.VCLibraries.<locals>.<listcomp>)ryr[rR)rCr�r�rrFr�VCLibrariesrs


zEnvironmentInfo.VCLibrariescCs|jdkrgSt|jjd�gS)z�
        Microsoft Visual C++ store references Libraries.

        Return
        ------
        list of str
            paths
        r0zLib\store\references)ryrr�r�rFrrr�VCStoreRefs�s

zEnvironmentInfo.VCStoreRefscCs|j}t|jd�g}|jdkr"dnd}|j�|�}|rL|t|jd|�g7}|jdkr|d|jjdd�}|t|j|�g7}n�|jdkr�|j��r�d	nd
}|t|j||jjdd��g7}|jj	|jj
kr�|t|j||jjdd��g7}n|t|jd�g7}|S)
zr
        Microsoft Visual C++ Tools.

        Return
        ------
        list of str
            paths
        Z
VCPackagesr9TF�Bin%sr0r�r�z
bin\HostX86%sz
bin\HostX64%sr��Bin)r�rr�ryr[rUrQrLrRrKrG)rCr��toolsrTr�r�Zhost_dirrrr�VCTools�s0


���
zEnvironmentInfo.VCToolscCsh|jdkr.|jjddd�}t|jjd|�gS|jjdd�}t|jjd�}|j}t|d||f�gSdS)	zw
        Microsoft Windows SDK Libraries.

        Return
        ------
        list of str
            paths
        r9Tr�r�r�r�z%sum%sN)ryr[rRrr�r��_sdk_subdir)rCr�r�Zlibverrrr�OSLibraries�s

zEnvironmentInfo.OSLibrariescCsht|jjd�}|jdkr&|t|d�gS|jdkr8|j}nd}t|d|�t|d|�t|d|�gSd	S)
zu
        Microsoft Windows SDK Include.

        Return
        ------
        list of str
            paths
        �includer9Zglr0rz%ssharedz%sumz%swinrtN)rr�r�ryr�)rCr��sdkverrrr�
OSIncludes�s


�zEnvironmentInfo.OSIncludescCs�t|jjd�}g}|jdkr&||j7}|jdkr@|t|d�g7}|jdkr�||t|jjd�t|dd�t|d	d�t|d
d�t|jjddd
|jddd�g7}|S)z}
        Microsoft Windows SDK Libraries Paths.

        Return
        ------
        list of str
            paths
        Z
Referencesr7r�zCommonConfiguration\Neutralr0Z
UnionMetadataz'Windows.Foundation.UniversalApiContractz1.0.0.0z%Windows.Foundation.FoundationContractz,Windows.Networking.Connectivity.WwanContractZ
ExtensionSDKszMicrosoft.VCLibsr�ZCommonConfigurationZneutral)rr�r�ryr�)rC�ref�libpathrrr�	OSLibpath�s.






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

        Return
        ------
        list of str
            paths
        )�list�
_sdk_toolsrFrrr�SdkToolss
zEnvironmentInfo.SdkToolsccs�|jdkr,|jdkrdnd}t|jj|�V|j��s\|jjdd�}d|}t|jj|�V|jdkr�|j��rvd	}n|jjddd
�}d|}t|jj|�VnB|jdkr�t|jjd�}|jjdd�}|jj}t|d||f�V|jj	r�|jj	Vd
S)z�
        Microsoft Windows SDK Tools paths generator.

        Return
        ------
        generator of str
            paths
        r�r�r�zBin\x86Tr�r�)r9r�rr�zBin\NETFX 4.0 Tools%sz%s%sN)
ryrr�r�r[rLrQrIr�r�)rCZbin_dirr�r�r�rrrr�s(	




zEnvironmentInfo._sdk_toolscCs|jj}|rd|SdS)zu
        Microsoft Windows SDK version subdir.

        Return
        ------
        str
            subdir
        �%s\r)r�r��rC�ucrtverrrrr�6s
zEnvironmentInfo._sdk_subdircCs|jdkrgSt|jjd�gS)zs
        Microsoft Windows SDK Setup.

        Return
        ------
        list of str
            paths
        r7ZSetup)ryrr�r�rFrrr�SdkSetupCs

zEnvironmentInfo.SdkSetupcs�|j}|j�|jdkr0d}|��o,|��}n$|��p>|��}|jdkpR|jdk}g}|rt|�fdd��jD�7}|r�|�fdd��jD�7}|S)zv
        Microsoft .NET Framework Tools.

        Return
        ------
        list of str
            paths
        r9TrAcsg|]}t�j|��qSr)rr��r�r+�r�rrr�hs�z+EnvironmentInfo.FxTools.<locals>.<listcomp>csg|]}t�j|��qSr)rr�r�r�rrr�ks�)	r[r�ryrIrLrKrGr�r�)rCr[Z	include32Z	include64r�rr�r�FxToolsRs"

��zEnvironmentInfo.FxToolscCs8|jdks|jjsgS|jjdd�}t|jjd|�gS)z~
        Microsoft .Net Framework SDK Libraries.

        Return
        ------
        list of str
            paths
        r0Tr�zlib\um%s)ryr�r�r[rRr)rCr�rrr�NetFxSDKLibrariesos
z!EnvironmentInfo.NetFxSDKLibrariescCs&|jdks|jjsgSt|jjd�gS)z}
        Microsoft .Net Framework SDK Includes.

        Return
        ------
        list of str
            paths
        r0z
include\um)ryr�r�rrFrrr�NetFxSDKIncludess
z EnvironmentInfo.NetFxSDKIncludescCst|jjd�gS)z�
        Microsoft Visual Studio Team System Database.

        Return
        ------
        list of str
            paths
        z
VSTSDB\Deployr�rFrrr�VsTDb�s
zEnvironmentInfo.VsTDbcCsv|jdkrgS|jdkr0|jj}|jjdd�}n|jj}d}d|j|f}t||�g}|jdkrr|t||d�g7}|S)zn
        Microsoft Build Engine.

        Return
        ------
        list of str
            paths
        r�r�Tr�rzMSBuild\%0.1f\bin%sZRoslyn)ryr�r�r[rQr�r)rC�	base_pathr�r�Zbuildrrr�MSBuild�s



zEnvironmentInfo.MSBuildcCs|jdkrgSt|jjd�gS)zt
        Microsoft HTML Help Workshop.

        Return
        ------
        list of str
            paths
        r�zHTML Help Workshop)ryrr�r�rFrrr�HTMLHelpWorkshop�s

z EnvironmentInfo.HTMLHelpWorkshopcCsD|jdkrgS|jjdd�}t|jjd�}|j}t|d||f�gS)z�
        Microsoft Universal C Runtime SDK Libraries.

        Return
        ------
        list of str
            paths
        r0Tr�r�z%sucrt%s)ryr[rRrr�r��_ucrt_subdir)rCr�r�r�rrr�
UCRTLibraries�s

zEnvironmentInfo.UCRTLibrariescCs.|jdkrgSt|jjd�}t|d|j�gS)z�
        Microsoft Universal C Runtime SDK Include.

        Return
        ------
        list of str
            paths
        r0r�z%sucrt)ryrr�r�r�)rCr�rrr�UCRTIncludes�s

zEnvironmentInfo.UCRTIncludescCs|jj}|rd|SdS)z�
        Microsoft Universal C Runtime SDK version subdir.

        Return
        ------
        str
            subdir
        r�r)r�r�r�rrrr��s
zEnvironmentInfo._ucrt_subdircCs(d|jkrdkrnngS|jjgS)zk
        Microsoft Visual F#.

        Return
        ------
        list of str
            paths
        r�r�)ryr�r�rFrrr�FSharp�s
zEnvironmentInfo.FSharpc
Cs�d|j}|jjdd��d�}g}|jj}t|�dd��}t|�rft	|t
|�d�}||t	|d�g7}|t	|d	�g7}d
|jdd
t|j�df}t
�||�D]&\}}t	||||�}	t|	�r�|	Sq�dS)
z
        Microsoft Visual C++ runtime redistributable dll.

        Return
        ------
        str
            path
        zvcruntime%d0.dllTr�rSz\Toolsz\Redistr8ZonecoreZredistzMicrosoft.VC%d.CRT�
N)rzr[rR�stripr�r�rrBrrr�intry�	itertools�productr)
rCZ	vcruntimer��prefixesZ
tools_pathZredist_pathZcrt_dirsr�Zcrt_dirr�rrr�VCRuntimeRedists 

�zEnvironmentInfo.VCRuntimeRedistTcCs�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�}|jdkr�t|j�r�|j|d<|S)z�
        Return environment dict.

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

        Return
        ------
        dict
            environment
        r�r�r�r�)r�r�r�r��Zpy_vcruntime_redist)�dict�_build_pathsr�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�ryrr�)rC�exists�envrrrr)&sV�������	�� 
zEnvironmentInfo.return_envc
Csptj�|�}t�|d��t�}t�||�}|r<ttt	|��n|}|s\d|�
�}tj�
|��|�|�}	t�|	�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 %s environment variable is empty)r��chain�
from_iterablerrWr�rr��filterr�upperr$r%r&�_unique_everseenr)
rCrmZspec_path_listsrZ
spec_pathsZ	env_pathsr�Zextant_pathsr�Zunique_pathsrrrr�Xs
zEnvironmentInfo._build_pathsccsbt�}|j}|dkr6t|j|�D]}||�|Vq n(|D]"}||�}||kr:||�|Vq:dS)z�
        List unique elements, preserving order.
        Remember all elements ever seen.

        _unique_everseen('AAAABBBCCDAABBB') --> A B C D

        _unique_everseen('ABBCcAD', str.lower) --> A B C D
        N)r|�addr
�__contains__)�iterabler�seenZseen_addZelement�krrrrzs

z EnvironmentInfo._unique_everseen)Nr)T)N)#rrrrVrDrXryrzr�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r)r�r�rrrrrr(sn
	







$


 
#












"
2"r()r")r)*rVr��ior�osrrZos.pathrrrrr3�platformr�Zdistutils.errorsr$Z#setuptools.extern.packaging.versionr	Zsetuptools.extern.six.movesr
Zmonkeyr�systemrrr��ImportErrorr%r&Z_msvc9_suppress_errorsZdistutils.msvc9compilerrrr#r2r6r*r?rYrrr(rrrr�<module>sJ�	*
& 
$s5

?>