AlkantarClanX12

Your IP : 13.59.92.247


Current Path : /opt/alt/python37/lib/python3.7/site-packages/setuptools/__pycache__/
Upload File :
Current File : //opt/alt/python37/lib/python3.7/site-packages/setuptools/__pycache__/msvc.cpython-37.pyc

B

��Re���@s�dZddlZddlmZddlmZmZddlmZm	Z	m
Z
mZddlZddl
Z
ddlZddlZddlZddlZddlmZddlmZdd	lmZe��d
kr�ddlZddlmZnGdd
�d
�Ze�ZeejjfZ yddl!m"Z"Wne k
r�YnXdd�Z#d/dd�Z$dd�Z%dd�Z&ddddd�Z'dd�Z(dd�Z)d d!�Z*d"d#�Z+d0d%d&�Z,Gd'd(�d(�Z-Gd)d*�d*�Z.Gd+d,�d,�Z/Gd-d.�d.�Z0dS)1a�
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)�unique_everseen�)�
get_unpatched�Windows)�environc@seZdZdZdZdZdZdS)�winregN)�__name__�
__module__�__qualname__�
HKEY_USERS�HKEY_CURRENT_USER�HKEY_LOCAL_MACHINE�HKEY_CLASSES_ROOT�rr��/builddir/build/BUILDROOT/alt-python37-setuptools-58.3.0-4.el8.x86_64/opt/alt/python37/lib/python3.7/site-packages/setuptools/msvc.pyr+sr)�RegcCs�d}|d|f}yt�|d�}WnJtk
rjy|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)r�	get_value�KeyErrorrrr�msvc9_find_vcvarsall)�versionZvc_base�key�
productdir�	vcvarsallrrrrBs
r�x86c
Os�ytt�}|||f|�|�Stjjk
r2Yntk
rDYnXyt||���Stjjk
r�}zt|||��Wdd}~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�kwargs�orig�excrrrr$lsr$cCs�yt�tjddtjtjB�}Wntk
r2dSXd}d}|��x�t��D]�}yt�||�\}}}Wntk
r|PYnX|rL|tj	krLt
|�rLytt|��}Wnt
tfk
r�wLYnX|dkrL||krL||}}qLWWdQRX||fS)z0Python 3.8 "distutils/_msvccompiler.py" backportz'Software\Microsoft\VisualStudio\SxS\VC7r)NNN�)r�OpenKeyr�KEY_READZKEY_WOW64_32KEY�OSError�	itertools�count�	EnumValue�REG_SZr�int�floatr(�	TypeError)r �best_version�best_dir�i�vZvc_dirZvtrrrr�_msvc14_find_vc2015�s0rAcCs�t�d�pt�d�}|sdSy>t�t|ddd�ddd	d
dd
dd
dddg�jddd���}Wntjtt	fk
rvdSXt|ddd�}t
|�r�d|fSdS)a�Python 3.8 "distutils/_msvccompiler.py" backport

    Returns "15, path" based on the result of invoking vswhere.exe
    If no install is found, returns "None, None"

    The version is returned to avoid unnecessarily changing the function
    result. It may be ignored when the path is not None.

    If vswhere.exe is not available, by definition, VS 2017 is not
    installed.
    zProgramFiles(x86)�ProgramFiles)NNzMicrosoft Visual StudioZ	Installerzvswhere.exez-latestz-prereleasez-requiresAnyz	-requiresz1Microsoft.VisualStudio.Component.VC.Tools.x86.x64z)Microsoft.VisualStudio.Workload.WDExpressz	-property�installationPathz	-products�*�mbcs�strict)�encodingr&�VCZ	AuxiliaryZBuild�)r�get�
subprocess�check_outputr�decode�strip�CalledProcessErrorr5�UnicodeDecodeErrorr)�root�pathrrr�_msvc14_find_vc2017�s(
rS�x64ZarmZarm64)r#Z	x86_amd64Zx86_armZ	x86_arm64c	
Cs�t�\}}d}|tkr t|}nd|kr,dnd}|r�t|ddddd|d	d
�	}yddl}|j|dd
�d}Wntttfk
r�d}YnX|s�t�\}}|r�t|d|dd
�}|s�dSt|d�}t|�s�dS|r�t|�s�d}||fS)z0Python 3.8 "distutils/_msvccompiler.py" backportN�amd64rTr#z..�redistZMSVCz**zMicrosoft.VC14*.CRTzvcruntime140.dllrT)�	recursive���zMicrosoft.VC140.CRT)NNz
vcvarsall.bat)	rS�PLAT_SPEC_TO_RUNTIMEr�glob�ImportErrorr5�LookupErrorrAr)	�	plat_spec�_r>�	vcruntimeZvcruntime_platZvcredistrZr=r"rrr�_msvc14_find_vcvarsall�s6




r`c
Cs�dtkrdd�t��D�St|�\}}|s6tj�d��y&tjd�||�tj	d�j
ddd	�}Wn:tjk
r�}ztj�d
�|j��|�Wdd}~XYnXdd�d
d�|�
�D�D�}|r�||d<|S)z0Python 3.8 "distutils/_msvccompiler.py" backportZDISTUTILS_USE_SDKcSsi|]\}}||���qSr)�lower)�.0r �valuerrr�
<dictcomp>sz&_msvc14_get_vc_env.<locals>.<dictcomp>zUnable to find vcvarsall.batzcmd /u /c "{}" {} && set)�stderrzutf-16le�replace)r&zError executing {}NcSs$i|]\}}}|r|r||���qSr)ra)rbr r^rcrrrrdscss|]}|�d�VqdS)�=N)�	partition)rb�linerrr�	<genexpr>sz%_msvc14_get_vc_env.<locals>.<genexpr>�py_vcruntime_redist)r�itemsr`r%r&r'rKrL�format�STDOUTrMrO�cmd�
splitlines)r]r"r_�outr1�envrrr�_msvc14_get_vc_envs*

rsc
Cs@yt|�Stjjk
r:}zt|d��Wdd}~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
    g,@N)rsr%r&r'r+)r]r1rrr�msvc14_get_vc_env(s

rtcOsBdtjkr4ddl}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�modules�numpyr	�__version__r%Z	ccompilerZgen_lib_optionsr�msvc14_gen_lib_options)r.r/�nprrrryBs

ryrcCs�|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 cz;Microsoft Visual C++ {version:0.1f} or greater is required.z-www.microsoft.com/download/details.aspx?id=%dg"@Zia64rXz( Get it with "Microsoft Windows SDK 7.0"z% Get it from http://aka.ms/vcpython27g$@z* Get it with "Microsoft Windows SDK 7.1": iW g,@zd Get it with "Microsoft C++ Build Tools": https://visualstudio.microsoft.com/visual-cpp-build-tools/N)r.rarm�locals�find)r1rr-�message�tmplZ
msdownloadrrrr+Os


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)NrTrU)rarfr-)�selfr-rrr�__init__szPlatformInfo.__init__cCs|j|j�d�dd�S)zs
        Return Target CPU architecture.

        Return
        ------
        str
            Target CPU
        r^rN)r-r|)r�rrr�
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#)r�)r�rrr�
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_cpu)r�rrr�current_is_x86�s	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#rrUz\x64z\%s)r�)r��hidex86rTrrr�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
        ------
        str
            subfolder: '\current', or '' (see hidex86 parameter)
        r#rrUz\x64z\%s)r�)r�r�rTrrr�
target_dir�szPlatformInfo.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_)r�r�r�rf)r��forcex86�currentrrr�	cross_dir�szPlatformInfo.cross_dirN)FF)FF)F)rrr�__doc__rrJrar�r��propertyr�r�r�r�r�r�rrrrrts

rc@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)r�Z
platform_inforrrr��szRegistryInfo.__init__cCsdS)z�
        Microsoft Visual Studio root registry key.

        Return
        ------
        str
            Registry key
        ZVisualStudior)r�rrr�visualstudio�s
zRegistryInfo.visualstudiocCst|jd�S)z
        Microsoft Visual Studio SxS registry key.

        Return
        ------
        str
            Registry key
        ZSxS)rr�)r�rrr�sxss
zRegistryInfo.sxscCst|jd�S)z|
        Microsoft Visual C++ VC7 registry key.

        Return
        ------
        str
            Registry key
        ZVC7)rr�)r�rrr�vcs
zRegistryInfo.vccCst|jd�S)z
        Microsoft Visual Studio VS7 registry key.

        Return
        ------
        str
            Registry key
        ZVS7)rr�)r�rrr�vss
zRegistryInfo.vscCsdS)z�
        Microsoft Visual C++ for Python registry key.

        Return
        ------
        str
            Registry key
        zDevDiv\VCForPythonr)r�rrr�
vc_for_python(s
zRegistryInfo.vc_for_pythoncCsdS)zq
        Microsoft SDK registry key.

        Return
        ------
        str
            Registry key
        zMicrosoft SDKsr)r�rrr�
microsoft_sdk4s
zRegistryInfo.microsoft_sdkcCst|jd�S)z�
        Microsoft Windows/Platform SDK registry key.

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

        Return
        ------
        str
            Registry key
        ZNETFXSDK)rr�)r�rrr�	netfx_sdkLs
zRegistryInfo.netfx_sdkcCsdS)z�
        Microsoft Windows Kits Roots registry key.

        Return
        ------
        str
            Registry key
        zWindows Kits\Installed Rootsr)r�rrr�windows_kits_rootsXs
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
        rZWow6432NodeZSoftware�	Microsoft)r�r�r)r�r r#Znode64rrr�	microsoftdszRegistryInfo.microsoftc	
Cs�tj}tj}tj}|j}x�|jD]�}d}y||||�d|�}WnZttfk
r�|j�	�s�y||||d�d|�}Wq�ttfk
r�w Yq�Xnw YnXz.yt�
||�dSttfk
r�YnXWd|r�||�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
        NrT)rr4r3ZCloseKeyr��HKEYSr5�IOErrorr�r��QueryValueEx)	r�r �nameZkey_readZopenkeyZclosekey�ms�hkey�bkeyrrr�lookupws*


zRegistryInfo.lookupN)F)rrrr�rrrrrr�r�r�r�r�r�r�r�r�r�r�r�r�r�rrrrr��s"
r�c@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.
    �WinDirrrBzProgramFiles(x86)NcCs2||_|jj|_|��|_|p$|��|_|_dS)N)�rir��find_programdata_vs_vers�known_vs_paths�_find_latest_available_vs_ver�vs_ver�vc_ver)r�Z
registry_infor�rrrr��s

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 foundrX)�find_reg_vs_versr�r%r&r'�set�update�sorted)r�Zreg_vc_versZvc_versrrrr��s	
z(SystemInfo._find_latest_available_vs_vercCs:|jj}|jj|jj|jjf}g}�xt�|jj|�D]�\}}yt�	|||�dtj
�}Wnttfk
rrw6YnX|��t�
|�\}}}	xLt|�D]@}
t�t��,tt�||
�d�}||kr�|�|�WdQRXq�WxJt|�D]>}
t�t��*tt�||
��}||k�r|�|�WdQRXq�WWdQRXq6Wt|�S)z�
        Find Microsoft Visual Studio versions available in registry.

        Return
        ------
        list of float
            Versions
        rN)r�r�r�r�r�r6�productr�rr3r4r5r�ZQueryInfoKey�range�
contextlib�suppressr(r;r8�append�EnumKeyr�)r�r�ZvckeysZvs_versr�r r�Zsubkeys�valuesr^r?r,rrrr��s*	
&zSystemInfo.find_reg_vs_versc	Cs�i}d}yt|�}Wnttfk
r,|SXx�|D]~}y\t||d�}t|ddd��}t�|�}WdQRX|d}tt|d��|||�|d	�<Wq4tttfk
r�w4Yq4Xq4W|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.json�rtzutf-8)rGNrCz
VC\Tools\MSVCZinstallationVersion)	rr5r�rr�json�load�_as_float_versionr)	r�Zvs_versionsZ
instances_dirZhashed_namesr�Z
state_pathZ
state_file�stateZvs_pathrrrr��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.1fz%0.1f)r�ProgramFilesx86r�r�r�r�)r��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')r�rR�msgrrr�VCInstallDir:s

zSystemInfo.VCInstallDirc
Cs�|jdkrdSy|j|j}Wntk
r8|j}YnXt|d�}y"t|�d}|�|�|_t||�Stt	t
fk
r�dSXdS)zl
        Locate Visual C++ for VS2017+.

        Return
        ------
        str
            path
        g,@rz
VC\Tools\MSVCrXN)r�r�rr�rrr�r�r5r��
IndexError)r�Zvs_dirZguess_vcr�rrrr�Ls	


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\VCz%0.1frrH)rr�r�r�r�r�r�)r�r�Zreg_pathZ	python_vcZ
default_vcrrrr�js	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
        g"@)z7.0z6.1z6.0ag$@)z7.1z7.0ag&@)z8.0z8.0ag(@)z8.1z8.1ag,@)z10.0z8.1N)r�)r�rrr�WindowsSdkVersion~s





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

        Return
        ------
        str
            version
        �lib)�_use_last_dir_namer�
WindowsSdkDir)r�rrr�WindowsSdkLastVersion�s
z SystemInfo.WindowsSdkLastVersioncCsd}x4|jD]*}t|jjd|�}|j�|d�}|rPqW|rFt|�svt|jjd|j�}|j�|d�}|rvt|d�}|r�t|�s�x@|jD]6}|d|�d��}d	|}t|j	|�}t|�r�|}q�W|r�t|��sx.|jD]$}d
|}t|j	|�}t|�r�|}q�W|�st|j
d�}|S)zn
        Microsoft Windows SDK directory.

        Return
        ------
        str
            path
        rzv%s�installationfolderz%0.1frZWinSDKNr�zMicrosoft SDKs\Windows Kits\%szMicrosoft SDKs\Windows\v%sZPlatformSDK)r�rr�r�r�rr�r��rfindrBr�)r��sdkdirr,�locrR�install_baseZintver�drrrr��s6

zSystemInfo.WindowsSdkDirc	Cs�|jdkrd}d}n&d}|jdkr&dnd}|jjd|d�}d	||�d
d�f}g}|jdkr�x$|jD]}|t|jj||�g7}qdWx(|jD]}|t|jj	d
||�g7}q�Wx"|D]}|j�
|d�}|r�|Sq�WdS)zy
        Microsoft Windows SDK executable directory.

        Return
        ------
        str
            path
        g&@�#r�(g(@TF)rTr�zWinSDK-NetFx%dTools%sr��-g,@zv%sAr�N)r�r�r�rf�NetFxSdkVersionrr�r�r�r�r�)	r�Znetfxverr-r�ZfxZregpathsr,rRZexecpathrrr�WindowsSDKExecutablePath�s"


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)rr�r�r�r�)r�rRrrr�FSharpInstallDir�s
zSystemInfo.FSharpInstallDircCsF|jdkrdnd}x.|D]&}|j�|jjd|�}|r|p<dSqWdS)zt
        Microsoft Universal CRT SDK directory.

        Return
        ------
        str
            path
        g,@)�10Z81rz
kitsroot%srN)r�r�r�r�)r��versr,r�rrr�UniversalCRTSdkDir�s

zSystemInfo.UniversalCRTSdkDircCs|�t|jd��S)z�
        Microsoft Universal C Runtime SDK last version.

        Return
        ------
        str
            version
        r�)r�rr�)r�rrr�UniversalCRTSdkLastVersions
z%SystemInfo.UniversalCRTSdkLastVersioncCs|jdkrdSdS)z�
        Microsoft .NET Framework SDK versions.

        Return
        ------
        tuple of str
            versions
        g,@)	z4.7.2z4.7.1z4.7z4.6.2z4.6.1z4.6z4.5.2z4.5.1z4.5r)r�)r�rrrr�szSystemInfo.NetFxSdkVersioncCs:d}x0|jD]&}t|jj|�}|j�|d�}|rPqW|S)zu
        Microsoft .NET Framework SDK directory.

        Return
        ------
        str
            path
        rZkitsinstallationfolder)r�rr�r�r�)r�r�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)rr�r�r�r�)r��guess_fwrrr�FrameworkDir32<szSystemInfo.FrameworkDir32cCs"t|jd�}|j�|jjd�p |S)zw
        Microsoft .NET Framework 64bit directory.

        Return
        ------
        str
            path
        zMicrosoft.NET\Framework64Zframeworkdir64)rr�r�r�r�)r�r�rrr�FrameworkDir64LszSystemInfo.FrameworkDir64cCs
|�d�S)z�
        Microsoft .NET Framework 32bit versions.

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

        Return
        ------
        tuple of str
            versions
        �@)r�)r�rrr�FrameworkVersion64hs
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%dr@rg(@zv4.0g$@Nr�Zv4z
v4.0.30319zv3.5g"@)zv3.5z
v2.0.50727g @)zv3.0z
v2.0.50727)r�r�r��getattrr�r�ra)r��bitsZreg_verZdot_net_dirr,rrrr�ts

 

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|VqdS)N)rr�
startswith)rb�dir_name)rR�prefixrrrj�sz0SystemInfo._use_last_dir_name.<locals>.<genexpr>Nr)�reversedr�next)rRr�Z
matching_dirsr)rRr�rr��szSystemInfo._use_last_dir_name)N)r)#rrrr�rrJr�rBr�r�r�r�r��staticmethodr�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�rrrrr��s:


*+#
r�c@sTeZdZdZd=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 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.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)
rr�r�r�r��sir�r%r&r')r�r-r�Z
vc_min_ver�errrrrr��s

zEnvironmentInfo.__init__cCs|jjS)zk
        Microsoft Visual Studio.

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

        Return
        ------
        float
            version
        )r�r�)r�rrrr��s
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\Toolsg,@T)r�rTz1Common7\IDE\CommonExtensions\Microsoft\TestWindowzTeam Tools\Performance ToolszTeam Tools\Performance Tools%scsg|]}t�jj|��qSr)rr�r�)rbrR)r�rr�
<listcomp>�sz+EnvironmentInfo.VSTools.<locals>.<listcomp>)r�r�r�)r��paths�arch_subdirr)r�r�VSTools�s



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

        Return
        ------
        list of str
            paths
        �IncludezATLMFC\Include)rr�r�)r�rrr�
VCIncludes�s
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
        g.@T)rT)r�zLib%szATLMFC\Lib%sg,@zLib\store%scsg|]}t�jj|��qSr)rr�r�)rbrR)r�rrr�sz/EnvironmentInfo.VCLibraries.<locals>.<listcomp>)r�r�r�)r�r�r�r)r�r�VCLibrariess


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

        Return
        ------
        list of str
            paths
        g,@zLib\store\references)r�rr�r�)r�rrr�VCStoreRefss

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
VCPackagesg$@TFzBin%sg,@)r�g.@z
bin\HostX86%sz
bin\HostX64%s)rT�Bin)r�rr�r�r�r�r�r�r�r�r�)r�r��toolsr�r�rRZhost_dirrrr�VCTools(s&


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
        g$@T)r�rTzLib%s)rTr�z%sum%sN)r�r�r�rr�r��_sdk_subdir)r�r�r�Zlibverrrr�OSLibrariesMs

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
        �includeg$@�glg,@rz%ssharedz%sumz%swinrtN)rr�r�r�r�)r�r��sdkverrrr�
OSIncludesas


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
Referencesg"@g&@zCommonConfiguration\Neutralg,@Z
UnionMetadataz'Windows.Foundation.UniversalApiContractz1.0.0.0z%Windows.Foundation.FoundationContractz,Windows.Networking.Connectivity.WwanContractZ
ExtensionSDKszMicrosoft.VCLibsz%0.1fZCommonConfigurationZneutral)rr�r�r�r�)r��ref�libpathrrr�	OSLibpathys*






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

        Return
        ------
        list of str
            paths
        )�list�
_sdk_tools)r�rrr�SdkTools�s
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
        g.@g&@r�zBin\x86T)rTzBin%s)g$@g&@r)r�rTzBin\NETFX 4.0 Tools%sz%s%sN)
r�rr�r�r�r�r�r�r�r�)r��bin_dirr�rRr�rrrr�s(	




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

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

        Return
        ------
        list of str
            paths
        g"@ZSetup)r�rr�r�)r�rrr�SdkSetup�s

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
        g$@TrUcsg|]}t�j|��qSr)rr�)rbr,)r�rrr��sz+EnvironmentInfo.FxTools.<locals>.<listcomp>csg|]}t�j|��qSr)rr�)rbr,)r�rrr�s)	r�r�r�r�r�r�r�r�r�)r�r�Z	include32Z	include64r�r)r�r�FxTools�s

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

        Return
        ------
        list of str
            paths
        g,@T)rTzlib\um%s)r�r�r�r�r�r)r�r�rrr�NetFxSDKLibrariess
z!EnvironmentInfo.NetFxSDKLibrariescCs&|jdks|jjsgSt|jjd�gS)z}
        Microsoft .Net Framework SDK Includes.

        Return
        ------
        list of str
            paths
        g,@z
include\um)r�r�r�r)r�rrr�NetFxSDKIncludess
z EnvironmentInfo.NetFxSDKIncludescCst|jjd�gS)z�
        Microsoft Visual Studio Team System Database.

        Return
        ------
        list of str
            paths
        z
VSTSDB\Deploy)rr�r�)r�rrr�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
        g(@g.@T)r�rzMSBuild\%0.1f\bin%sZRoslyn)r�r�r�r�r�r�r)r��	base_pathr�rR�buildrrr�MSBuild0s


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

        Return
        ------
        list of str
            paths
        g&@zHTML Help Workshop)r�rr�r�)r�rrr�HTMLHelpWorkshopLs

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

        Return
        ------
        list of str
            paths
        g,@T)rTr�z%sucrt%s)r�r�r�rr�r��_ucrt_subdir)r�r�r�rrrr�
UCRTLibraries[s

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

        Return
        ------
        list of str
            paths
        g,@r�z%sucrt)r�rr�r�r)r�r�rrr�UCRTIncludesms

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

        Return
        ------
        str
            subdir
        z%s\r)r�r�)r�rrrrr}s
zEnvironmentInfo._ucrt_subdircCs(d|jkrdkrnngS|jjgS)zk
        Microsoft Visual F#.

        Return
        ------
        list of str
            paths
        g&@g(@)r�r�r�)r�rrr�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}x2t
�||�D]"\}}t	||||�}	t|	�r�|	Sq�WdS)
z
        Microsoft Visual C++ runtime redistributable dll.

        Return
        ------
        str
            path
        zvcruntime%d0.dllT)rTr�z\Toolsz\RedistrXZonecorerVzMicrosoft.VC%d.CRT�
N)r�r�r�rNr�r�rrfrrrr:r�r6r�r)
r�r_r��prefixesZ
tools_pathZredist_pathZcrt_dirsr�Zcrt_dirrRrrr�VCRuntimeRedist�s

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�rrR)r�r�rrRr2rk)�dict�_build_pathsr�r�rrr�r�r	rr
r�rr�r�rrrrrrr�rr)r��existsrrrrrr*�sD

zEnvironmentInfo.return_envc
Csntj�|�}t�|d��t�}t�||�}|r<ttt	|��n|}|s\d|�
�}tj�
|��t|�}	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)r6�chain�
from_iterablerrJr�rr�filterr�upperr%r&r'r
r)
r�r�Zspec_path_listsrZ
spec_pathsZ	env_pathsr�Zextant_pathsr�Zunique_pathsrrrr�szEnvironmentInfo._build_paths)Nr)T)!rrrr�r�r�r�r�r�r�r�r�r�r�r�rrrr�rr	r
rrrrrrrrrr*rrrrrr)�s:
	
%$#

#
2r))r#)r)1r�r��ior�osrr�os.pathrrrrrur��platformr6rK�distutils.errorsr%Z#setuptools.extern.packaging.versionr	Z setuptools.extern.more_itertoolsr
Zmonkeyr�systemrrrr[r&r'Z_msvc9_suppress_errorsZdistutils.msvc9compilerrrr$rArSrYr`rsrtryr+rr�r�r)rrrr�<module>s\
*
&&'$
%s: