AlkantarClanX12

Your IP : 18.225.254.81


Current Path : /proc/self/root/lib/python3.6/site-packages/setuptools/__pycache__/
Upload File :
Current File : //proc/self/root/lib/python3.6/site-packages/setuptools/__pycache__/msvc.cpython-36.pyc

3

9��f���@sdZddlZddlZddlZddlZddlZddlmZddl	m
Z
ddlmZej
�dkrpddl	mZejZnGd	d
�d
�Ze�ZeejjfZyddlmZWnek
r�YnXdd
�Zd dd�Zdd�Zdd�Zd!dd�ZGdd�d�ZGdd�d�ZGdd�d�ZGdd�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.0:
    Microsoft Visual C++ Build Tools 2015 (x86, x64, arm)
    Microsoft Visual Studio 2017 (x86, x64, arm, arm64)
    Microsoft Visual Studio Build Tools 2017 (x86, x64, arm, arm64)
�N)�
LegacyVersion)�filterfalse�)�
get_unpatched�Windows)�winregc@seZdZdZdZdZdZdS)rN)�__name__�
__module__�__qualname__�
HKEY_USERS�HKEY_CURRENT_USER�HKEY_LOCAL_MACHINE�HKEY_CLASSES_ROOT�rr�/usr/lib/python3.6/msvc.pyr(sr)�RegcCs�d}|d|f}ytj|d�}WnJtk
rjy|d|f}tj|d�}Wntk
rdd}YnXYnX|r�tjjjj|d�}tjj|�r�|Stt�|�S)a+
    Patched "distutils.msvc9compiler.find_vcvarsall" to use the standalone
    compiler build for Python (VCForPython). Fall back to original behavior
    when the standalone compiler is not available.

    Redirect the path of "vcvarsall.bat".

    Known supported compilers
    -------------------------
    Microsoft Visual C++ 9.0:
        Microsoft Visual C++ Compiler for Python 2.7 (x86, amd64)

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

    Return
    ------
    vcvarsall.bat path: str
    z-Software\%sMicrosoft\DevDiv\VCForPython\%0.1f��
installdirzWow6432Node\Nz
vcvarsall.bat)	rZ	get_value�KeyError�os�path�join�isfiler�msvc9_find_vcvarsall)�versionZVC_BASE�key�
productdir�	vcvarsallrrrr?sr�x86cOs�ytt�}|||f|�|�Stjjk
r2Yntk
rDYnXyt||�j�Stjjk
r�}zt|||��WYdd}~XnXdS)a�
    Patched "distutils.msvc9compiler.query_vcvarsall" for support extra
    compilers.

    Set environment without use of "vcvarsall.bat".

    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)

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

    Return
    ------
    environment: dict
    N)	r�msvc9_query_vcvarsall�	distutils�errors�DistutilsPlatformError�
ValueError�EnvironmentInfo�
return_env�_augment_exception)�ver�arch�args�kwargsZorig�excrrrrjsrcCsnytt�|�Stjjk
r$YnXyt|dd�j�Stjjk
rh}zt|d��WYdd}~XnXdS)a'
    Patched "distutils._msvccompiler._get_vc_env" for support extra
    compilers.

    Set environment without use of "vcvarsall.bat".

    Known supported compilers
    -------------------------
    Microsoft Visual C++ 14.0:
        Microsoft Visual C++ Build Tools 2015 (x86, x64, arm)
        Microsoft Visual Studio 2017 (x86, x64, arm, arm64)
        Microsoft Visual Studio Build Tools 2017 (x86, x64, arm, arm64)

    Parameters
    ----------
    plat_spec: str
        Target architecture.

    Return
    ------
    environment: dict
    g,@)�
vc_min_verN)r�msvc14_get_vc_envr r!r"r$r%r&)Z	plat_specr+rrrr-�s
r-cOsBdtjkr4ddl}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*Znprrrr1�s

r1rcCs�|jd}d|j�ks"d|j�kr�d}|jft��}d}|dkrr|j�jd�dkrh|d	7}||d
7}q�|d7}n.|dkr�|d
7}||d7}n|dkr�|d7}|f|_dS)zl
    Add details to the exception message to help guide the user
    as to what action will resolve it.
    rrzvisual cz0Microsoft Visual C++ {version:0.1f} is required.z-www.microsoft.com/download/details.aspx?id=%dg"@Zia64rz* Get it with "Microsoft Windows SDK 7.0": iBz% Get it from http://aka.ms/vcpython27g$@z* Get it with "Microsoft Windows SDK 7.1": iW g,@zj Get it with "Microsoft Visual C++ Build Tools": http://landinghub.visualstudio.com/visual-cpp-build-toolsN���)r)�lower�format�locals�find)r+rr(�messageZtmplZ
msdownloadrrrr&�s 

r&c@sbeZdZdZejdd�j�Zdd�Ze	dd��Z
dd	�Zd
d�Zdd
d�Z
ddd�Zddd�ZdS)�PlatformInfoz�
    Current and Target Architectures informations.

    Parameters
    ----------
    arch: str
        Target architecture.
    Zprocessor_architecturercCs|j�jdd�|_dS)N�x64�amd64)r3�replacer()�selfr(rrr�__init__�szPlatformInfo.__init__cCs|j|jjd�dd�S)N�_r)r(r6)r<rrr�
target_cpu�szPlatformInfo.target_cpucCs
|jdkS)Nr)r?)r<rrr�
target_is_x86szPlatformInfo.target_is_x86cCs
|jdkS)Nr)�current_cpu)r<rrr�current_is_x86szPlatformInfo.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
        ------
        subfolder: str
            '	arget', or '' (see hidex86 parameter)
        rrr:z\x64z\%s)rA)r<�hidex86r9rrr�current_dir	szPlatformInfo.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
        ------
        subfolder: str
            '\current', or '' (see hidex86 parameter)
        rrr:z\x64z\%s)r?)r<rCr9rrr�
target_dirszPlatformInfo.target_dircCs0|rdn|j}|j|krdS|j�jdd|�S)ao
        Cross platform specific subfolder.

        Parameters
        ----------
        forcex86: bool
            Use 'x86' as current architecture even if current acritecture is
            not x86.

        Return
        ------
        subfolder: str
            '' if target architecture is current architecture,
            '\current_target' if not.
        rr�\z\%s_)rAr?rEr;)r<�forcex86Zcurrentrrr�	cross_dir5szPlatformInfo.cross_dirN)FF)FF)F)rr	r
�__doc__�safe_env�getr3rAr=�propertyr?r@rBrDrErHrrrrr8�s

r8c@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 informations.

    Parameters
    ----------
    platform_info: PlatformInfo
        "PlatformInfo" instance.
    cCs
||_dS)N)�pi)r<Z
platform_inforrrr=ZszRegistryInfo.__init__cCsdS)z<
        Microsoft Visual Studio root registry key.
        ZVisualStudior)r<rrr�visualstudio]szRegistryInfo.visualstudiocCstjj|jd�S)z;
        Microsoft Visual Studio SxS registry key.
        ZSxS)rrrrO)r<rrr�sxsdszRegistryInfo.sxscCstjj|jd�S)z8
        Microsoft Visual C++ VC7 registry key.
        ZVC7)rrrrP)r<rrr�vckszRegistryInfo.vccCstjj|jd�S)z;
        Microsoft Visual Studio VS7 registry key.
        ZVS7)rrrrP)r<rrr�vsrszRegistryInfo.vscCsdS)z?
        Microsoft Visual C++ for Python registry key.
        zDevDiv\VCForPythonr)r<rrr�
vc_for_pythonyszRegistryInfo.vc_for_pythoncCsdS)z-
        Microsoft SDK registry key.
        zMicrosoft SDKsr)r<rrr�
microsoft_sdk�szRegistryInfo.microsoft_sdkcCstjj|jd�S)z>
        Microsoft Windows/Platform SDK registry key.
        r)rrrrT)r<rrr�windows_sdk�szRegistryInfo.windows_sdkcCstjj|jd�S)z<
        Microsoft .NET Framework SDK registry key.
        ZNETFXSDK)rrrrT)r<rrr�	netfx_sdk�szRegistryInfo.netfx_sdkcCsdS)z<
        Microsoft Windows Kits Roots registry key.
        zWindows Kits\Installed Rootsr)r<rrr�windows_kits_roots�szRegistryInfo.windows_kits_rootsFcCs(|jj�s|rdnd}tjjd|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: value
        rZWow6432NodeZSoftwareZ	Microsoft)rNrBrrr)r<rrZnode64rrr�	microsoft�szRegistryInfo.microsoftcCs�tj}tj}|j}x�|jD]�}y||||�d|�}WnZttfk
r�|jj�s�y||||d�d|�}Wq�ttfk
r�wYq�XnwYnXytj	||�dSttfk
r�YqXqWdS)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�OpenKeyrX�HKEYS�OSError�IOErrorrNrBZQueryValueEx)r<r�namerYZopenkey�ms�hkey�bkeyrrr�lookup�s"

zRegistryInfo.lookupN)F)rr	r
rIrrrr
rr[r=rLrOrPrQrRrSrTrUrVrWrXrbrrrrrMLs"
rMc@s$eZdZdZejdd�Zejdd�Zejde�Zd3dd�Z	d	d
�Z
dd�Zed
d��Z
edd��Zdd�Zdd�Zedd��Zedd��Zedd��Zedd��Zedd��Zedd ��Zed!d"��Zed#d$��Zed%d&��Zed'd(��Zed)d*��Zed+d,��Zed-d.��Zd/d0�Zd4d1d2�ZdS)5�
SystemInfoz�
    Microsoft Windows and Visual Studio related system inormations.

    Parameters
    ----------
    registry_info: RegistryInfo
        "RegistryInfo" instance.
    vc_ver: float
        Required Microsoft Visual C++ version.
    �WinDirr�ProgramFileszProgramFiles(x86)NcCs"||_|jj|_|p|j�|_dS)N)�rirN�_find_latest_available_vc_ver�vc_ver)r<Z
registry_inforhrrrr=�s
zSystemInfo.__init__cCs6y|j�dStk
r0d}tjj|��YnXdS)Nrz%No Microsoft Visual C++ version foundr2)�find_available_vc_vers�
IndexErrorr r!r")r<�errrrrrg�s
z(SystemInfo._find_latest_available_vc_vercCs6|jj}|jj|jj|jjf}g}�x|jjD]�}x�|D]�}ytj|||�dtj�}Wnt	t
fk
rpw8YnXtj|�\}}}	xPt|�D]D}
y*t
tj||
�d�}||kr�|j|�Wq�tk
r�Yq�Xq�WxPt|�D]D}
y(t
tj||
��}||k�r|j|�Wq�tk
�r Yq�Xq�Wq8Wq.Wt|�S)zC
        Find all available Microsoft Visual C++ versions.
        r)rfrXrQrSrRr[rrZrYr\r]ZQueryInfoKey�range�floatZ	EnumValue�appendr#ZEnumKey�sorted)r<r_ZvckeysZvc_versr`rraZsubkeys�valuesr>�ir'rrrri�s2


z!SystemInfo.find_available_vc_verscCs6d|j}tjj|j|�}|jj|jjd|j�p4|S)z4
        Microsoft Visual Studio directory.
        zMicrosoft Visual Studio %0.1fz%0.1f)rhrrr�ProgramFilesx86rfrbrR)r<r^�defaultrrr�VSInstallDir
s
zSystemInfo.VSInstallDircCs�|j|j�p|j�}tjj|jjd|j�}|jj	|d�}|rNtjj|d�n|}|jj	|jj
d|j�pl|}tjj|�s�d}tj
j|��|S)z1
        Microsoft Visual C++ directory.
        z%0.1frZVCz(Microsoft Visual C++ directory not found)rt�	_guess_vc�_guess_vc_legacyrrrrfrSrhrbrQ�isdirr r!r")r<�guess_vcZreg_pathZ	python_vcZ
default_vcr�msgrrr�VCInstallDirszSystemInfo.VCInstallDirc
Cs^|jdkrdSd}tjj|j|�}ytj|�d}tjj||�Stttfk
rXYnXdS)z*
        Locate Visual C for 2017
        g,@Nz
VC\Tools\MSVCrr2)	rhrrrrt�listdirr\r]rj)r<rsrxZvc_exact_verrrrru0s
zSystemInfo._guess_vccCsd|j}tjj|j|�S)z<
        Locate Visual C for versions prior to 2017
        z Microsoft Visual Studio %0.1f\VC)rhrrrrr)r<rsrrrrv@s
zSystemInfo._guess_vc_legacycCsJ|jdkrdS|jdkrdS|jdkr*dS|jdkr8dS|jdkrFdSdS)zN
        Microsoft Windows SDK versions for specified MSVC++ version.
        g"@�7.0�6.1�6.0ag$@�7.1�7.0ag&@�8.0�8.0ag(@�8.1�8.1ag,@�10.0N)r|r}r~)rr�)r�r�)r�r�)r�r�)rh)r<rrr�WindowsSdkVersionGs




zSystemInfo.WindowsSdkVersioncCs|jtjj|jd��S)z4
        Microsoft Windows SDK last version
        �lib)�_use_last_dir_namerrr�
WindowsSdkDir)r<rrr�WindowsSdkLastVersionWs
z SystemInfo.WindowsSdkLastVersioncCsTd}x8|jD].}tjj|jjd|�}|jj|d�}|rPqW|sRtjj|�r�tjj|jjd|j	�}|jj|d�}|r�tjj|d�}|s�tjj|�r�xH|jD]>}|d|j
d��}d	|}tjj|j|�}tjj|�r�|}q�W|s�tjj|��r:x:|jD]0}d
|}tjj|j|�}tjj|��r|}�qW|�sPtjj|jd�}|S)z2
        Microsoft Windows SDK directory.
        rzv%s�installationfolderz%0.1frZWinSDKN�.zMicrosoft SDKs\Windows Kits\%szMicrosoft SDKs\Windows\v%sZPlatformSDK)
r�rrrrfrUrbrwrSrh�rfindrerz)r<�sdkdirr'�locrZinstall_baseZintver�drrrr�_s6
zSystemInfo.WindowsSdkDirc	Cs�|jdkrd}d}n&d}|jdkr&dnd}|jjd|d�}d	||jd
d�f}g}|jdkr�x(|jD]}|tjj|jj	||�g7}qdWx,|j
D]"}|tjj|jjd
||�g7}q�Wx |D]}|jj|d�}|r�Pq�W|S)z=
        Microsoft Windows SDK executable directory.
        g&@�#r�(g(@TF)r9rCzWinSDK-NetFx%dTools%srF�-g,@zv%sAr�)
rhrNrDr;�NetFxSdkVersionrrrrfrVr�rUrb)	r<Znetfxverr(rCZfxZregpathsr'rZexecpathrrr�WindowsSDKExecutablePath�s$

"
z#SystemInfo.WindowsSDKExecutablePathcCs.d|j}tjj|jj|�}|jj|d�p,dS)z0
        Microsoft Visual F# directory.
        z%0.1f\Setup\F#rr)rhrrrrfrOrb)r<rrrr�FSharpInstallDir�s
zSystemInfo.FSharpInstallDircCsF|jdkrd}nf}x(|D] }|jj|jjd|�}|rPqW|pDdS)z8
        Microsoft Universal CRT SDK directory.
        g,@�10�81z
kitsroot%sr)r�r�)rhrfrbrW)r<Zversr'r�rrr�UniversalCRTSdkDir�s


zSystemInfo.UniversalCRTSdkDircCs|jtjj|jd��S)z@
        Microsoft Universal C Runtime SDK last version
        r�)r�rrrr�)r<rrr�UniversalCRTSdkLastVersion�s
z%SystemInfo.UniversalCRTSdkLastVersioncCs|jdkrdSfSdS)z8
        Microsoft .NET Framework SDK versions.
        g,@�4.6.1�4.6N)r�r�)rh)r<rrrr��s
zSystemInfo.NetFxSdkVersioncCs>x4|jD]*}tjj|jj|�}|jj|d�}|rPqW|p<dS)z9
        Microsoft .NET Framework SDK directory.
        Zkitsinstallationfolderr)r�rrrrfrVrb)r<r'r�r�rrr�NetFxSdkDir�szSystemInfo.NetFxSdkDircCs&tjj|jd�}|jj|jjd�p$|S)z;
        Microsoft .NET Framework 32bit directory.
        zMicrosoft.NET\FrameworkZframeworkdir32)rrrrdrfrbrQ)r<�guess_fwrrr�FrameworkDir32�szSystemInfo.FrameworkDir32cCs&tjj|jd�}|jj|jjd�p$|S)z;
        Microsoft .NET Framework 64bit directory.
        zMicrosoft.NET\Framework64Zframeworkdir64)rrrrdrfrbrQ)r<r�rrr�FrameworkDir64�szSystemInfo.FrameworkDir64cCs
|jd�S)z:
        Microsoft .NET Framework 32bit versions.
        � )�_find_dot_net_versions)r<rrr�FrameworkVersion32�szSystemInfo.FrameworkVersion32cCs
|jd�S)z:
        Microsoft .NET Framework 64bit versions.
        �@)r�)r<rrr�FrameworkVersion64�szSystemInfo.FrameworkVersion64cCs�|jj|jjd|�}t|d|�}|p6|j|d�p6d}|jdkrL|df}n:|jdkrx|j�dd	�d
krndn|df}n|jd
kr�d}|jdkr�d}|S)z�
        Find Microsoft .NET Framework versions.

        Parameters
        ----------
        bits: int
            Platform number of bits: 32 or 64.
        zframeworkver%dzFrameworkDir%d�vrg(@zv4.0g$@N�Zv4z
v4.0.30319�v3.5g"@�
v2.0.50727g @�v3.0)r�r�)r�r�)rfrbrQ�getattrr�rhr3)r<�bitsZreg_verZdot_net_dirr'Zframeworkverrrrr�s





z!SystemInfo._find_dot_net_versionscs,��fdd�ttj���D�}t|d�p*dS)z�
        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 startings by this prefix
        c3s2|]*}tjjtjj�|��r|j��r|VqdS)N)rrrwr�
startswith)�.0Zdir_name)r�prefixrr�	<genexpr>)sz0SystemInfo._use_last_dir_name.<locals>.<genexpr>Nr)�reversedrr{�next)r<rr�Z
matching_dirsr)rr�rr�szSystemInfo._use_last_dir_name)N)r) rr	r
rIrJrKrdrerrr=rgrirLrtrzrurvr�r�r�r�r�r�r�r�r�r�r�r�r�r�r�rrrrrc�s4

&	rcc@sReZdZdZd=dd�Zedd��Zedd	��Zed
d��Zedd
��Z	edd��Z
edd��Zedd��Zedd��Z
edd��Zedd��Zdd�Zedd��Zedd��Zed d!��Zed"d#��Zed$d%��Zed&d'��Zed(d)��Zed*d+��Zed,d-��Zed.d/��Zed0d1��Zed2d3��Zed4d5��Zd>d7d8�Zd9d:�Zd?d;d<�Z dS)@r$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.0.

    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}tjj	|��dS)Nz.No suitable Microsoft Visual C++ version found)
r8rNrMrfrc�sirhr r!r")r<r(rhr,rkrrrr=Is

zEnvironmentInfo.__init__cCs|jjS)z/
        Microsoft Visual C++ version.
        )r�rh)r<rrrrhRszEnvironmentInfo.vc_vercsVddg}�jdkrD�jjddd�}|dg7}|dg7}|d|g7}�fd	d
�|D�S)z/
        Microsoft Visual Studio Tools
        zCommon7\IDEz
Common7\Toolsg,@T)rCr9z1Common7\IDE\CommonExtensions\Microsoft\TestWindowzTeam Tools\Performance ToolszTeam Tools\Performance Tools%scsg|]}tjj�jj|��qSr)rrrr�rt)r�r)r<rr�
<listcomp>fsz+EnvironmentInfo.VSTools.<locals>.<listcomp>)rhrNrD)r<�paths�arch_subdirr)r<r�VSToolsYs


zEnvironmentInfo.VSToolscCs$tjj|jjd�tjj|jjd�gS)zL
        Microsoft Visual C++ & Microsoft Foundation Class Includes
        ZIncludezATLMFC\Include)rrrr�rz)r<rrr�
VCIncludeshszEnvironmentInfo.VCIncludescsb�jdkr�jjdd�}n�jjdd�}d|d|g}�jdkrP|d|g7}�fd	d
�|D�S)zM
        Microsoft Visual C++ & Microsoft Foundation Class Libraries
        g.@T)r9)rCzLib%szATLMFC\Lib%sg,@zLib\store%scsg|]}tjj�jj|��qSr)rrrr�rz)r�r)r<rrr�~sz/EnvironmentInfo.VCLibraries.<locals>.<listcomp>)rhrNrE)r<r�r�r)r<r�VCLibrariesps

zEnvironmentInfo.VCLibrariescCs"|jdkrgStjj|jjd�gS)zA
        Microsoft Visual C++ store references Libraries
        g,@zLib\store\references)rhrrrr�rz)r<rrr�VCStoreRefs�s
zEnvironmentInfo.VCStoreRefscCs|j}tjj|jd�g}|jdkr&dnd}|jj|�}|rT|tjj|jd|�g7}|jdkr�d|jjdd�}|tjj|j|�g7}n�|jdkr�|jj	�r�d	nd
}|tjj|j||jj
dd��g7}|jj|jjkr�|tjj|j||jjdd��g7}n|tjj|jd�g7}|S)
z,
        Microsoft Visual C++ Tools
        Z
VCPackagesg$@TFzBin%sg,@)rCg.@z
bin\HostX86%sz
bin\HostX64%s)r9�Bin)
r�rrrrzrhrNrHrDrBrErAr?)r<r��toolsrGr�rZhost_dirrrr�VCTools�s&

zEnvironmentInfo.VCToolscCst|jdkr2|jjddd�}tjj|jjd|�gS|jjdd�}tjj|jjd�}|j}tjj|d||f�gSdS)	z1
        Microsoft Windows SDK Libraries
        g$@T)rCr9zLib%s)r9r�z%sum%sN)	rhrNrErrrr�r��_sdk_subdir)r<r�r�Zlibverrrr�OSLibraries�s
zEnvironmentInfo.OSLibrariescCs|tjj|jjd�}|jdkr.|tjj|d�gS|jdkr@|j}nd}tjj|d|�tjj|d|�tjj|d|�gSd	S)
z/
        Microsoft Windows SDK Include
        �includeg$@Zglg,@rz%ssharedz%sumz%swinrtN)rrrr�r�rhr�)r<r��sdkverrrr�
OSIncludes�s

zEnvironmentInfo.OSIncludescCs�tjj|jjd�}g}|jdkr*||j7}|jdkrH|tjj|d�g7}|jdkr�||tjj|jjd�tjj|dd�tjj|d	d�tjj|d
d�tjj|jjddd
|jddd�g7}|S)z7
        Microsoft Windows SDK Libraries Paths
        Z
Referencesg"@g&@zCommonConfiguration\Neutralg,@Z
UnionMetadataz'Windows.Foundation.UniversalApiContractz1.0.0.0z%Windows.Foundation.FoundationContractz,Windows.Networking.Connectivity.WwanContractZ
ExtensionSDKszMicrosoft.VCLibsz%0.1fZCommonConfigurationZneutral)rrrr�r�rhr�)r<�ref�libpathrrr�	OSLibpath�s>




zEnvironmentInfo.OSLibpathcCst|j��S)z-
        Microsoft Windows SDK Tools
        )�list�
_sdk_tools)r<rrr�SdkTools�szEnvironmentInfo.SdkToolsccs|jdkr0|jdkrdnd}tjj|jj|�V|jj�sd|jjdd�}d|}tjj|jj|�V|jdksx|jdkr�|jj	�r�d	}n|jjddd
�}d|}tjj|jj|�VnL|jdk�rtjj|jjd�}|jjdd�}|jj
}tjj|d||f�V|jj�r|jjVd
S)z=
        Microsoft Windows SDK Tools paths generator
        g.@g&@r�zBin\x86T)r9zBin%sg$@r)rCr9zBin\NETFX 4.0 Tools%sz%s%sN)rhrrrr�r�rNrBrDr@r�r�)r<Zbin_dirr�rr�rrrr��s(



zEnvironmentInfo._sdk_toolscCs|jj}|rd|SdS)z6
        Microsoft Windows SDK version subdir
        z%s\r)r�r�)r<�ucrtverrrrr�szEnvironmentInfo._sdk_subdircCs"|jdkrgStjj|jjd�gS)z-
        Microsoft Windows SDK Setup
        g"@ZSetup)rhrrrr�r�)r<rrr�SdkSetup%s
zEnvironmentInfo.SdkSetupcs�|j}|j�|jdkr0d}|j�o,|j�}n$|j�p>|j�}|jdkpR|jdk}g}|rt|�fdd��jD�7}|r�|�fdd��jD�7}|S)z0
        Microsoft .NET Framework Tools
        g$@Tr:csg|]}tjj�j|��qSr)rrrr�)r�r')r�rrr�@sz+EnvironmentInfo.FxTools.<locals>.<listcomp>csg|]}tjj�j|��qSr)rrrr�)r�r')r�rrr�Cs)	rNr�rhr@rBrAr?r�r�)r<rNZ	include32Z	include64r�r)r�r�FxTools/s
zEnvironmentInfo.FxToolscCs>|jdks|jjrgS|jjdd�}tjj|jjd|�gS)z8
        Microsoft .Net Framework SDK Libraries
        g,@T)r9zlib\um%s)rhr�r�rNrErrr)r<r�rrr�NetFxSDKLibrariesGsz!EnvironmentInfo.NetFxSDKLibrariescCs,|jdks|jjrgStjj|jjd�gS)z7
        Microsoft .Net Framework SDK Includes
        g,@z
include\um)rhr�r�rrr)r<rrr�NetFxSDKIncludesRsz EnvironmentInfo.NetFxSDKIncludescCstjj|jjd�gS)z>
        Microsoft Visual Studio Team System Database
        z
VSTSDB\Deploy)rrrr�rt)r<rrr�VsTDb\szEnvironmentInfo.VsTDbcCs~|jdkrgS|jdkr0|jj}|jjdd�}n|jj}d}d|j|f}tjj||�g}|jdkrz|tjj||d�g7}|S)z(
        Microsoft Build Engine
        g(@g.@T)rCrzMSBuild\%0.1f\bin%sZRoslyn)	rhr�rrrNrDrtrrr)r<�	base_pathr�rZbuildrrr�MSBuildcs


zEnvironmentInfo.MSBuildcCs"|jdkrgStjj|jjd�gS)z.
        Microsoft HTML Help Workshop
        g&@zHTML Help Workshop)rhrrrr�rr)r<rrr�HTMLHelpWorkshopzs
z EnvironmentInfo.HTMLHelpWorkshopcCsL|jdkrgS|jjdd�}tjj|jjd�}|j}tjj|d||f�gS)z=
        Microsoft Universal C Runtime SDK Libraries
        g,@T)r9r�z%sucrt%s)	rhrNrErrrr�r��_ucrt_subdir)r<r�r�r�rrr�
UCRTLibraries�s
zEnvironmentInfo.UCRTLibrariescCs6|jdkrgStjj|jjd�}tjj|d|j�gS)z;
        Microsoft Universal C Runtime SDK Include
        g,@r�z%sucrt)rhrrrr�r�r�)r<r�rrr�UCRTIncludes�s
zEnvironmentInfo.UCRTIncludescCs|jj}|rd|SdS)zB
        Microsoft Universal C Runtime SDK version subdir
        z%s\r)r�r�)r<r�rrrr��szEnvironmentInfo._ucrt_subdircCs |jdkr|jdkrgS|jjS)z%
        Microsoft Visual F#
        g&@g(@)rhr�r�)r<rrr�FSharp�szEnvironmentInfo.FSharpcCsl|jjdd�}|jdkr&|jj}d}n|jjjdd�}d}|jdkrHdn|j}|||j|f}tjj||�S)	zA
        Microsoft Visual C++ runtime redistribuable dll
        T)r9�z-redist%s\Microsoft.VC%d0.CRT\vcruntime%d0.dllz\Toolsz\Redistz.onecore%s\Microsoft.VC%d0.CRT\vcruntime%d0.dllg,@)	rNrErhr�rzr;rrr)r<r�Zredist_pathZ	vcruntimeZdll_verrrr�VCRuntimeRedist�s
zEnvironmentInfo.VCRuntimeRedistTcCs�t|jd|j|j|j|jg|�|jd|j|j|j|j	|j
g|�|jd|j|j|j|jg|�|jd|j
|j|j|j|j|j|j|j|jg	|�d�}|jdkr�tjj|j�r�|j|d<|S)z�
        Return environment dict.

        Parameters
        ----------
        exists: bool
            It True, only return existing paths.
        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�rhrrrr�)r<�exists�envrrrr%�sD	

zEnvironmentInfo.return_envc
Csxtjj|�}tj|d�jtj�}tj||�}|rBtt	tj
j|��n|}|sbd|j�}t
jj|��|j|�}	tjj|	�S)a
        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.
        rz %s environment variable is empty)�	itertools�chain�
from_iterablerJrK�splitr�pathsepr��filterrrw�upperr r!r"�_unique_everseenr)
r<r^Zspec_path_listsr�Z
spec_pathsZ	env_pathsr�Zextant_pathsryZunique_pathsrrrr��s	
zEnvironmentInfo._build_pathsccsjt�}|j}|dkr:xPt|j|�D]}||�|Vq"Wn,x*|D]"}||�}||kr@||�|Vq@WdS)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)�set�addr�__contains__)r<�iterabler�seenZseen_add�element�krrrr�s	
z EnvironmentInfo._unique_everseen)Nr)T)N)!rr	r
rIr=rLrhr�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�rrrrr$1s:
		 -





-r$)r)r)!rIrr.�platformr�Zdistutils.errorsr Z#setuptools.extern.packaging.versionrZsetuptools.extern.six.movesrZmonkeyr�systemr�environrJr��ImportErrorr!r"Z_msvc9_suppress_errorsZdistutils.msvc9compilerrrrr-r1r&r8rMrcr$rrrr�<module>s>
+
/&
%[b