Your IP : 18.223.241.235


Current Path : /opt/alt/python35/lib/python3.5/site-packages/setuptools/__pycache__/
Upload File :
Current File : //opt/alt/python35/lib/python3.5/site-packages/setuptools/__pycache__/msvc.cpython-35.pyc



�Re���@s�dZddlZddlZddlZddlZddlZddlmZddl	m
Z
ddlmZej
�dkr�ddl	mZejZnGd	d
�d
�Ze�ZeejjfZyddlmZWnek
r�YnXdd
�Zddd�Zdd�Zdd�Zddd�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@s(eZdZdZdZdZdZdS)rN)�__name__�
__module__�__qualname__�
HKEY_USERS�HKEY_CURRENT_USER�HKEY_LOCAL_MACHINE�HKEY_CLASSES_ROOT�rr��/builddir/build/BUILDROOT/alt-python35-setuptools-36.3.0-4.el8.x86_64/opt/alt/python35/lib/python3.5/site-packages/setuptools/msvc.pyr(sr)�RegcCs�d}|d|f}ytj|d�}WnStk
r�y&|d|f}tj|d�}Wntk
r|d}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)	r�	get_value�KeyError�os�path�join�isfiler�msvc9_find_vcvarsall)�versionZVC_BASE�key�
productdir�	vcvarsallrrrr?s

r�x86cOs�y#tt�}|||||�SWn)tjjk
r=Yntk
rNYnXyt||�j�SWn>tjjk
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�kwargs�orig�excrrrr js
r cCs�ytt�|�SWntjjk
r.YnXyt|dd�j�SWn;tjjk
r�}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
    �
vc_min_verg,@N)r�msvc14_get_vc_envr!r"r#r%r&r')Z	plat_specr-rrrr/�s
r/cOs_dtjkrLddl}t|j�td�krL|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�modules�numpyr�__version__r!Z	ccompilerZgen_lib_optionsr�msvc14_gen_lib_options)r*r+�nprrrr4�s
r4rcCs�|jd}d|j�ks1d|j�kr�d}|jt��}d}|dkr�|j�jd�dkr�|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)�message�tmplZ
msdownloadrrrr'�s 
$



r'c@s�eZdZdZejdd�j�Zdd�Ze	dd��Z
dd	�Zd
d�Zddd
d�Z
dddd�Zddd�ZdS)�PlatformInfoz�
    Current and Target Architectures informations.

    Parameters
    ----------
    arch: str
        Target architecture.
    Zprocessor_architecturercCs|j�jdd�|_dS)N�x64�amd64)r7�replacer))�selfr)rrr�__init__�szPlatformInfo.__init__cCs!|j|jjd�dd�S)N�_r)r)r:)rArrr�
target_cpu�szPlatformInfo.target_cpucCs
|jdkS)Nr)rD)rArrr�
target_is_x86szPlatformInfo.target_is_x86cCs
|jdkS)Nr)�current_cpu)rArrr�current_is_x86szPlatformInfo.current_is_x86FcCs=|jdkr|rdS|jdkr2|r2dSd|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)rF)rA�hidex86r>rrr�current_dir	szPlatformInfo.current_dircCs=|jdkr|rdS|jdkr2|r2dSd|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)rD)rArHr>rrr�
target_dirszPlatformInfo.target_dircCsB|rdn|j}|j|kr(dS|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_)rFrDrJr@)rA�forcex86�currentrrr�	cross_dir5szPlatformInfo.cross_dirN)rr	r
�__doc__�safe_env�getr7rFrB�propertyrDrErGrIrJrNrrrrr=�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 informations.

    Parameters
    ----------
    platform_info: PlatformInfo
        "PlatformInfo" instance.
    cCs
||_dS)N)�pi)rAZ
platform_inforrrrBZszRegistryInfo.__init__cCsdS)z<
        Microsoft Visual Studio root registry key.
        ZVisualStudior)rArrr�visualstudio]szRegistryInfo.visualstudiocCstjj|jd�S)z;
        Microsoft Visual Studio SxS registry key.
        ZSxS)rrrrU)rArrr�sxsdszRegistryInfo.sxscCstjj|jd�S)z8
        Microsoft Visual C++ VC7 registry key.
        ZVC7)rrrrV)rArrr�vckszRegistryInfo.vccCstjj|jd�S)z;
        Microsoft Visual Studio VS7 registry key.
        ZVS7)rrrrV)rArrr�vsrszRegistryInfo.vscCsdS)z?
        Microsoft Visual C++ for Python registry key.
        zDevDiv\VCForPythonr)rArrr�
vc_for_pythonyszRegistryInfo.vc_for_pythoncCsdS)z-
        Microsoft SDK registry key.
        zMicrosoft SDKsr)rArrr�
microsoft_sdk�szRegistryInfo.microsoft_sdkcCstjj|jd�S)z>
        Microsoft Windows/Platform SDK registry key.
        r)rrrrZ)rArrr�windows_sdk�szRegistryInfo.windows_sdkcCstjj|jd�S)z<
        Microsoft .NET Framework SDK registry key.
        ZNETFXSDK)rrrrZ)rArrr�	netfx_sdk�szRegistryInfo.netfx_sdkcCsdS)z<
        Microsoft Windows Kits Roots registry key.
        zWindows Kits\Installed Rootsr)rArrr�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
        rZWow6432NodeZSoftware�	Microsoft)rTrGrrr)rArrZnode64rrr�	microsoft�s!zRegistryInfo.microsoftcCs�tj}tj}|j}x�|jD]�}y||||�d|�}Wnmttfk
r�|jj�s�y"||||d�d|�}Wq�ttfk
r�w%Yq�Xnw%YnXytj	||�dSWq%ttfk
r�Yq%Xq%WdS)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�OpenKeyr_�HKEYS�OSError�IOErrorrTrG�QueryValueEx)rAr�namer`Zopenkey�ms�hkey�bkeyrrr�lookup�s"			"zRegistryInfo.lookupN)rr	r
rOrrrr
rrbrBrRrUrVrWrXrYrZr[r\r]r_rjrrrrrSLs"rSc@s�eZdZdZejdd�Zejdd�Zejde�Zddd�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�Zdd1d2�ZdS)3�
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)NcCs1||_|jj|_|p'|j�|_dS)N)�rirT�_find_latest_available_vc_ver�vc_ver)rAZ
registry_inforprrrrB�s	zSystemInfo.__init__cCsCy|j�dSWn*tk
r>d}tjj|��YnXdS)Nrz%No Microsoft Visual C++ version foundr6)�find_available_vc_vers�
IndexErrorr!r"r#)rA�errrrrro�s

z(SystemInfo._find_latest_available_vc_vercCs�|jj}|jj|jj|jjf}g}xF|jjD]8}x/|D]'}y%tj|||�dtj�}Wnt	t
fk
r�wMYnXtj|�\}}}	xbt|�D]T}
y9t
tj||
�d�}||kr�|j|�Wq�tk
rYq�Xq�Wx^t|�D]P}
y5t
tj||
��}||krZ|j|�Wq tk
roYq Xq WqMWq@Wt|�S)zC
        Find all available Microsoft Visual C++ versions.
        r)rnr_rWrYrXrbrrar`rcrdZQueryInfoKey�range�floatZ	EnumValue�appendr$�EnumKey�sorted)rArgZvckeysZvc_versrhrriZsubkeys�valuesrC�ir(rrrrq�s2!
%
	
z!SystemInfo.find_available_vc_verscCsKd|j}tjj|j|�}|jj|jjd|j�pJ|S)z4
        Microsoft Visual Studio directory.
        zMicrosoft Visual Studio %0.1fz%0.1f)rprrr�ProgramFilesx86rnrjrX)rArf�defaultrrr�VSInstallDir
s
zSystemInfo.VSInstallDircCs�|j|j�p|j�}tjj|jjd|j�}|jj	|d�}|rqtjj|d�n|}|jj	|jj
d|j�p�|}tjj|�s�d}tj
j|��|S)z1
        Microsoft Visual C++ directory.
        z%0.1frZVCz(Microsoft Visual C++ directory not found)r}�	_guess_vc�_guess_vc_legacyrrrrnrYrprjrW�isdirr!r"r#)rA�guess_vcZreg_pathZ	python_vcZ
default_vcr�msgrrr�VCInstallDirs"!(zSystemInfo.VCInstallDirc
Cs}|jdkrdSd}tjj|j|�}y*tj|�d}tjj||�SWntttfk
rxYnXdS)z*
        Locate Visual C for 2017
        g,@Nz
VC\Tools\MSVCrr6)	rprrrr}�listdirrcrdrr)rAr|r�Zvc_exact_verrrrr~0szSystemInfo._guess_vccCs#d|j}tjj|j|�S)z<
        Locate Visual C for versions prior to 2017
        z Microsoft Visual Studio %0.1f\VC)rprrrr{)rAr|rrrr@s
zSystemInfo._guess_vc_legacycCsc|jdkrdS|jdkr&dS|jdkr9dS|jdkrLdS|jdkr_dSdS)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�)r�r�)r�r�)r�r�)r�r�)rp)rArrr�WindowsSdkVersionGszSystemInfo.WindowsSdkVersioncCs|jtjj|jd��S)z4
        Microsoft Windows SDK last version
        �lib)�_use_last_dir_namerrr�
WindowsSdkDir)rArrr�WindowsSdkLastVersionWsz SystemInfo.WindowsSdkLastVersioncCs�d}xL|jD]A}tjj|jjd|�}|jj|d�}|rPqW|sotjj|�r�tjj|jjd|j	�}|jj|d�}|r�tjj|d�}|s�tjj|�rBxd|jD]Y}|d|j
d��}d	|}tjj|j|�}tjj|�r�|}q�W|s\tjj|�r�xK|jD]@}d
|}tjj|j|�}tjj|�rf|}qfW|s�tjj|jd�}|S)z2
        Microsoft Windows SDK directory.
        rzv%s�installationfolderz%0.1frZWinSDKN�.zMicrosoft SDKs\Windows Kits\%szMicrosoft SDKs\Windows\v%sZPlatformSDK)
r�rrrrnr[rjr�rYrp�rfindrmr�)rA�sdkdirr(�locr�install_baseZintver�drrrr�_s6"



zSystemInfo.WindowsSdkDirc	Cs2|jdkrd}d}n<d}|jdkr9dnd}|jjddd	|�}d
||jdd�f}g}|jd
kr�x6|jD]+}|tjj|jj	||�g7}q�Wx:|j
D]/}|tjj|jjd||�g7}q�Wx*|D]"}|jj|d�}|rPqW|S)z=
        Microsoft Windows SDK executable directory.
        g&@�#r�(g(@TFr>rHzWinSDK-NetFx%dTools%srK�-g,@zv%sAr�)
rprTrIr@�NetFxSdkVersionrrrrnr\r�r[rj)	rAZnetfxverr)rHZfxZregpathsr(rZexecpathrrr�WindowsSDKExecutablePath�s$	)-
z#SystemInfo.WindowsSDKExecutablePathcCsAd|j}tjj|jj|�}|jj|d�p@dS)z0
        Microsoft Visual F# directory.
        z%0.1f\Setup\F#rr)rprrrrnrUrj)rArrrr�FSharpInstallDir�s
zSystemInfo.FSharpInstallDircCs_|jdkrd}nf}x4|D],}|jj|jjd|�}|r%Pq%W|p^dS)z8
        Microsoft Universal CRT SDK directory.
        g,@�10�81z
kitsroot%sr)r�r�)rprnrjr])rA�versr(r�rrr�UniversalCRTSdkDir�s	

zSystemInfo.UniversalCRTSdkDircCs|jtjj|jd��S)z@
        Microsoft Universal C Runtime SDK last version
        r�)r�rrrr�)rArrr�UniversalCRTSdkLastVersion�sz%SystemInfo.UniversalCRTSdkLastVersioncCs|jdkrdSfSdS)z8
        Microsoft .NET Framework SDK versions.
        g,@�4.6.1�4.6N)r�r�)rp)rArrrr��szSystemInfo.NetFxSdkVersioncCsUxH|jD]=}tjj|jj|�}|jj|d�}|r
Pq
W|pTdS)z9
        Microsoft .NET Framework SDK directory.
        Zkitsinstallationfolderr)r�rrrrnr\rj)rAr(r�r�rrr�NetFxSdkDir�szSystemInfo.NetFxSdkDircCs7tjj|jd�}|jj|jjd�p6|S)z;
        Microsoft .NET Framework 32bit directory.
        zMicrosoft.NET\FrameworkZframeworkdir32)rrrrlrnrjrW)rA�guess_fwrrr�FrameworkDir32�szSystemInfo.FrameworkDir32cCs7tjj|jd�}|jj|jjd�p6|S)z;
        Microsoft .NET Framework 64bit directory.
        zMicrosoft.NET\Framework64Zframeworkdir64)rrrrlrnrjrW)rAr�rrr�FrameworkDir64�szSystemInfo.FrameworkDir64cCs
|jd�S)z:
        Microsoft .NET Framework 32bit versions.
        � )�_find_dot_net_versions)rArrr�FrameworkVersion32�szSystemInfo.FrameworkVersion32cCs
|jd�S)z:
        Microsoft .NET Framework 64bit versions.
        �@)r�)rArrr�FrameworkVersion64�szSystemInfo.FrameworkVersion64cCs�|jj|jjd|�}t|d|�}|pM|j|d�pMd}|jdkrn|df}nU|jdkr�|j�dd	�d
kr�dn|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�)rnrjrW�getattrr�rpr7)rA�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
        c3sE|];}tjjtjj�|��r|j��r|VqdS)N)rrr�r�
startswith)�.0�dir_name)r�prefixrr�	<genexpr>)s!z0SystemInfo._use_last_dir_name.<locals>.<genexpr>Nr)�reversedrr��next)rArr�Z
matching_dirsr)rr�rr�szSystemInfo._use_last_dir_name) rr	r
rOrPrQrlrmr{rBrorqrRr}r�r~rr�r�r�r�r�r�r�r�r�r�r�r�r�r�r�rrrrrk�s4
&	rkc@s�eZdZdZdddd�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��Zd6d7d8�Zd9d:�Zdd;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.
    NrcCsat|�|_t|j�|_t|j|�|_|j|kr]d}tjj	|��dS)Nz.No suitable Microsoft Visual C++ version found)
r=rTrSrnrk�sirpr!r"r#)rAr)rpr.rsrrrrBIszEnvironmentInfo.__init__cCs
|jjS)z/
        Microsoft Visual C++ version.
        )r�rp)rArrrrpRszEnvironmentInfo.vc_vercsxddg}�jdkra�jjdddd�}|dg7}|dg7}|d	|g7}�fd
d�|D�S)z/
        Microsoft Visual Studio Tools
        zCommon7\IDEz
Common7\Toolsg,@rHTr>z1Common7\IDE\CommonExtensions\Microsoft\TestWindowzTeam Tools\Performance ToolszTeam Tools\Performance Tools%scs+g|]!}tjj�jj|��qSr)rrrr�r})r�r)rArr�
<listcomp>fs	z+EnvironmentInfo.VSTools.<locals>.<listcomp>)rprTrI)rA�paths�arch_subdirr)rAr�VSToolsYs

zEnvironmentInfo.VSToolscCs4tjj|jjd�tjj|jjd�gS)zL
        Microsoft Visual C++ & Microsoft Foundation Class Includes
        �IncludezATLMFC\Include)rrrr�r�)rArrr�
VCIncludeshszEnvironmentInfo.VCIncludescs��jdkr'�jjdd�}n�jjdd�}d|d|g}�jdkrp|d|g7}�fd	d
�|D�S)zM
        Microsoft Visual C++ & Microsoft Foundation Class Libraries
        g.@r>TrHzLib%szATLMFC\Lib%sg,@zLib\store%scs+g|]!}tjj�jj|��qSr)rrrr�r�)r�r)rArrr�~s	z/EnvironmentInfo.VCLibraries.<locals>.<listcomp>)rprTrJ)rAr�r�r)rAr�VCLibrariespszEnvironmentInfo.VCLibrariescCs/|jdkrgStjj|jjd�gS)zA
        Microsoft Visual C++ store references Libraries
        g,@zLib\store\references)rprrrr�r�)rArrr�VCStoreRefs�szEnvironmentInfo.VCStoreRefscCs�|j}tjj|jd�g}|jdkr9dnd}|jj|�}|rz|tjj|jd|�g7}|jdkr�d|jjdd�}|tjj|j|�g7}n�|jdkrm|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,@rHg.@z
bin\HostX86%sz
bin\HostX64%sr>�Bin)
r�rrrr�rprTrNrIrGrJrFrD)rAr��toolsrLr�rZhost_dirrrr�VCTools�s&	#"&)zEnvironmentInfo.VCToolscCs�|jdkrJ|jjdddd�}tjj|jjd|�gS|jjdd�}tjj|jjd�}|j}tjj|d||f�gSdS)	z1
        Microsoft Windows SDK Libraries
        g$@rHTr>zLib%sr�z%sum%sN)	rprTrJrrrr�r��_sdk_subdir)rAr�r�Zlibverrrr�OSLibraries�s 	zEnvironmentInfo.OSLibrariescCs�tjj|jjd�}|jdkrC|tjj|d�gS|jdkr^|j}nd}tjj|d|�tjj|d|�tjj|d|�gSd	S)
z/
        Microsoft Windows SDK Include
        �includeg$@�glg,@rz%ssharedz%sumz%swinrtN)rrrr�r�rpr�)rAr��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�rpr�)rA�ref�libpathrrr�	OSLibpath�s>
					

zEnvironmentInfo.OSLibpathcCst|j��S)z-
        Microsoft Windows SDK Tools
        )�list�
_sdk_tools)rArrr�SdkTools�szEnvironmentInfo.SdkToolsccs�|jdkrD|jdkr$dnd}tjj|jj|�V|jj�s�|jjdd�}d|}tjj|jj|�V|jdks�|jdkr|jj	�r�d	}n|jjd
ddd�}d|}tjj|jj|�Vni|jdkrmtjj|jjd�}|jjdd�}|jj
}tjj|d||f�V|jjr�|jjVd
S)z=
        Microsoft Windows SDK Tools paths generator
        g.@g&@r�zBin\x86r>TzBin%sg$@rrHzBin\NETFX 4.0 Tools%sz%s%sN)rprrrr�r�rTrGrIrEr�r�)rA�bin_dirr�rr�rrrr��s(
	
zEnvironmentInfo._sdk_toolscCs|jj}|rd|SdS)z6
        Microsoft Windows SDK version subdir
        z%s\r)r�r�)rA�ucrtverrrrr�szEnvironmentInfo._sdk_subdircCs/|jdkrgStjj|jjd�gS)z-
        Microsoft Windows SDK Setup
        g"@ZSetup)rprrrr�r�)rArrr�SdkSetup%szEnvironmentInfo.SdkSetupcs�|j}|j�|jdkrDd}|j�o>|j�}n6|j�pY|j�}|jdkpw|jdk}g}|r�|�fdd��jD�7}|r�|�fdd��jD�7}|S)z0
        Microsoft .NET Framework Tools
        g$@Tr?cs(g|]}tjj�j|��qSr)rrrr�)r�r()r�rrr�@s	z+EnvironmentInfo.FxTools.<locals>.<listcomp>cs(g|]}tjj�j|��qSr)rrrr�)r�r()r�rrr�Cs	)	rTr�rprErGrFrDr�r�)rArTZ	include32Z	include64r�r)r�r�FxTools/s		zEnvironmentInfo.FxToolscCsU|jdks|jjr gS|jjdd�}tjj|jjd|�gS)z8
        Microsoft .Net Framework SDK Libraries
        g,@r>Tzlib\um%s)rpr�r�rTrJrrr)rAr�rrr�NetFxSDKLibrariesGsz!EnvironmentInfo.NetFxSDKLibrariescCs<|jdks|jjr gStjj|jjd�gS)z7
        Microsoft .Net Framework SDK Includes
        g,@z
include\um)rpr�r�rrr)rArrr�NetFxSDKIncludesRsz EnvironmentInfo.NetFxSDKIncludescCstjj|jjd�gS)z>
        Microsoft Visual Studio Team System Database
        z
VSTSDB\Deploy)rrrr�r})rArrr�VsTDb\szEnvironmentInfo.VsTDbcCs�|jdkrgS|jdkrF|jj}|jjdd�}n|jj}d}d|j|f}tjj||�g}|jdkr�|tjj||d�g7}|S)z(
        Microsoft Build Engine
        g(@g.@rHTrzMSBuild\%0.1f\bin%sZRoslyn)	rpr�r{rTrIr}rrr)rA�	base_pathr�r�buildrrr�MSBuildcszEnvironmentInfo.MSBuildcCs/|jdkrgStjj|jjd�gS)z.
        Microsoft HTML Help Workshop
        g&@zHTML Help Workshop)rprrrr�r{)rArrr�HTMLHelpWorkshopzsz EnvironmentInfo.HTMLHelpWorkshopcCsl|jdkrgS|jjdd�}tjj|jjd�}|j}tjj|d||f�gS)z=
        Microsoft Universal C Runtime SDK Libraries
        g,@r>Tr�z%sucrt%s)	rprTrJrrrr�r��_ucrt_subdir)rAr�r�r�rrr�
UCRTLibraries�s	zEnvironmentInfo.UCRTLibrariescCsK|jdkrgStjj|jjd�}tjj|d|j�gS)z;
        Microsoft Universal C Runtime SDK Include
        g,@r�z%sucrt)rprrrr�r�r�)rAr�rrr�UCRTIncludes�szEnvironmentInfo.UCRTIncludescCs|jj}|rd|SdS)zB
        Microsoft Universal C Runtime SDK version subdir
        z%s\r)r�r�)rAr�rrrr��szEnvironmentInfo._ucrt_subdircCs,|jdkr"|jdkr"gS|jjS)z%
        Microsoft Visual F#
        g&@g(@)rpr�r�)rArrr�FSharp�szEnvironmentInfo.FSharpcCs�|jjdd�}|jdkr9|jj}d}n|jjjdd�}d}|jdkrldn|j}|||j|f}tjj||�S)	zA
        Microsoft Visual C++ runtime redistribuable dll
        r>T�z-redist%s\Microsoft.VC%d0.CRT\vcruntime%d0.dllz\Toolsz\Redistz.onecore%s\Microsoft.VC%d0.CRT\vcruntime%d0.dllg,@)	rTrJrpr�r�r@rrr)rAr�Zredist_pathZ	vcruntimeZdll_verrrr�VCRuntimeRedist�s	zEnvironmentInfo.VCRuntimeRedistTcCstd|jd|j|j|j|jg|�d|jd|j|j|j|j	|j
g|�d|jd|j|j|j|jg|�d|jd|j
|j|j|j|j|j|j|j|jg	|��}|jdkrtjj|j�r|j|d<|S)z�
        Return environment dict.

        Parameters
        ----------
        exists: bool
            It True, only return existing paths.
        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�rprrrr�)rA�exists�envrrrr&�sD												$
zEnvironmentInfo.return_envc
Cs�tjj|�}tj|d�jtj�}tj||�}|rctt	tj
j|��n|}|s�d|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_iterablerPrQ�splitr�pathsepr��filterrr��upperr!r"r#�_unique_everseenr)
rArfZspec_path_listsr�Z
spec_pathsZ	env_pathsr�Zextant_pathsr�Zunique_pathsrrrr��s	'zEnvironmentInfo._build_pathsccs�t�}|j}|dkrMxdt|j|�D]}||�|Vq1Wn8x5|D]-}||�}||krT||�|VqTWdS)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__)rA�iterabler�seenZseen_add�element�krrrr�s			


z EnvironmentInfo._unique_everseen)!rr	r
rOrBrRrpr�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%)!rOrr0�platformr��distutils.errorsr!Z&pkg_resources.extern.packaging.versionrZsetuptools.extern.six.movesrZmonkeyr�systemr�environrPr��ImportErrorr"r#Z_msvc9_suppress_errorsZdistutils.msvc9compilerrrr r/r4r'r=rSrkr%rrrr�<module>s:	
+/&
%[��a

?>