Viewing File: /opt/alt/python38/lib/python3.8/site-packages/setuptools/__pycache__/msvc.cpython-38.pyc

U

+a@sdZddlZddlmZddlmZmZddlmZm	Z	m
Z
mZddlZddl
Z
ddlZddlZddlZddlZddlmZddlmZdd	lmZed
krddlZddlmZnGdd
d
ZeZeejjfZ zddl!m"Z"Wne k
rYnXddZ#d/ddZ$ddZ%ddZ&dddddZ'ddZ(ddZ)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)listdirpathsep)joinisfileisdirdirname)
LegacyVersion)unique_everseen)
get_unpatchedWindows)environc@seZdZdZdZdZdZdS)winregN)__name__
__module____qualname__
HKEY_USERSHKEY_CURRENT_USERHKEY_LOCAL_MACHINEHKEY_CLASSES_ROOTrr7/tmp/pip-install-1bd_1mtk/setuptools/setuptools/msvc.pyr+sr)RegcCsd}|d|f}zt|d}WnJtk
rjz|d|f}t|d}Wntk
rdd}YnXYnX|rt|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\N
vcvarsall.bat)r	get_valueKeyErrorrrrmsvc9_find_vcvarsall)versionZvc_basekey
productdir	vcvarsallrrrrBs
rx86c
Osztt}|||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	distutilserrorsDistutilsPlatformError
ValueErrorEnvironmentInfo
return_env_augment_exception)verarchargskwargsorigexcrrrr%lsr%cCszttjddtjtjB}Wntk
r4YdSXd}d}|tD]}zt||\}}}Wntk
rYqYnX|rL|tj	krLt
|rLztt|}Wnt
tfk
rYqLYnX|dkrL||krL||}}qLW5QRX||fS)0Python 3.8 "distutils/_msvccompiler.py" backportz'Software\Microsoft\VisualStudio\SxS\VC7rNNN)rOpenKeyrKEY_READZKEY_WOW64_32KEYOSError	itertoolscount	EnumValueREG_SZrintfloatr)	TypeError)r!best_versionbest_dirivZvc_dirZvtr rrr_msvc14_find_vc2015s2

rDcCstdptd}|sdSz>tt|dddddd	d
dd
dd
dddgjddd}Wntjtt	fk
rxYdSXt|ddd}t
|rd|fSdS)aPython 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.
    ProgramFiles(x86)ProgramFilesr4zMicrosoft Visual StudioZ	Installerzvswhere.exez-latestz-prereleasez-requiresAnyz	-requiresz1Microsoft.VisualStudio.Component.VC.Tools.x86.x64z)Microsoft.VisualStudio.Workload.WDExpressz	-propertyinstallationPathz	-products*mbcsstrict)encodingr'VCZ	AuxiliaryZBuild)rget
subprocesscheck_outputrdecodestripCalledProcessErrorr8UnicodeDecodeErrorr)rootpathrrr_msvc14_find_vc2017s6	
rWx64armZarm64)r$Z	x86_amd64Zx86_armZ	x86_arm64c	
Cst\}}d}|tkr t|}nd|kr,dnd}|rt|ddddd|d	d
	}zddl}|j|dd
d}Wntttfk
rd}YnX|st\}}|rt|d|dd
}|sdSt|d}t|sdS|rt|sd}||fS)r3Namd64rXr$z..redistZMSVCz**zMicrosoft.VC14*.CRTzvcruntime140.dllrT)	recursivezMicrosoft.VC140.CRTr4r)	rWPLAT_SPEC_TO_RUNTIMErglobImportErrorr8LookupErrorrDr)		plat_spec_rA	vcruntimeZvcruntime_platZvcredistr_r@r#rrr_msvc14_find_vcvarsalls>




rec
CsdtkrddtDSt|\}}|s6tjdz&tjd||tj	dj
ddd	}Wn:tjk
r}ztjd
|j|W5d}~XYnXddd
d|
DD}|r||d<|S)r3ZDISTUTILS_USE_SDKcSsi|]\}}||qSrlower).0r!valuerrr
<dictcomp>sz&_msvc14_get_vc_env.<locals>.<dictcomp>zUnable to find vcvarsall.batzcmd /u /c "{}" {} && set)stderrzutf-16lereplace)r'zError executing {}NcSs$i|]\}}}|r|r||qSrrf)rhr!rcrirrrrjs
css|]}|dVqdS)=N)	partition)rhlinerrr	<genexpr>sz%_msvc14_get_vc_env.<locals>.<genexpr>py_vcruntime_redist)ritemsrer&r'r(rOrPformatSTDOUTrQrScmd
splitlines)rbr#rdoutr2envrrr_msvc14_get_vc_envs:


ryc
CsBz
t|WStjjk
r<}zt|dW5d}~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
    ,@N)ryr&r'r(r,)rbr2rrrmsvc14_get_vc_env(s


r{cOsBdtjkr4ddl}t|jtdkr4|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)
sysmodulesZnumpyr	__version__r&Z	ccompilerZgen_lib_optionsrmsvc14_gen_lib_options)r/r0nprrrrBs

rrcCs|jd}d|ks"d|krd}|jft}d}|dkrf|ddkr\|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=%d"@Zia64r]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 rzzd Get it with "Microsoft C++ Build Tools": https://visualstudio.microsoft.com/visual-cpp-build-tools/N)r/rgrslocalsfind)r2r r.messagetmplZ
msdownloadrrrr,Os


r,c@sbeZdZdZeddZddZe	ddZ
dd	Zd
dZdd
dZ
dddZdddZdS)PlatformInfoz
    Current and Target Architectures information.

    Parameters
    ----------
    arch: str
        Target architecture.
    Zprocessor_architecturercCs|dd|_dS)NrXrZ)rgrlr.)selfr.rrr__init__szPlatformInfo.__init__cCs|j|jdddS)zs
        Return Target CPU architecture.

        Return
        ------
        str
            Target CPU
        rcrN)r.rrrrr
target_cpus
zPlatformInfo.target_cpucCs
|jdkS)z
        Return True if target CPU is x86 32 bits..

        Return
        ------
        bool
            CPU is x86 32 bits
        r$rrrrr
target_is_x86s	zPlatformInfo.target_is_x86cCs
|jdkS)z
        Return True if current CPU is x86 32 bits..

        Return
        ------
        bool
            CPU is x86 32 bits
        r$current_cpurrrrcurrent_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$rrZ\x64\%srrhidex86rXrrrcurrent_dirszPlatformInfo.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$rrZrrrrrrr
target_dirszPlatformInfo.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_)rrrrl)rforcex86currentrrr	cross_dirszPlatformInfo.cross_dirN)FF)FF)F)rrr__doc__rrNrgrrpropertyrrrrrrrrrrrts


rc@seZdZdZejejejejfZ	ddZ
eddZeddZ
edd	Zed
dZedd
ZeddZeddZeddZeddZdddZddZdS)RegistryInfoz
    Microsoft Visual Studio related registry information.

    Parameters
    ----------
    platform_info: PlatformInfo
        "PlatformInfo" instance.
    cCs
||_dSN)pi)rZ
platform_inforrrrszRegistryInfo.__init__cCsdS)z
        Microsoft Visual Studio root registry key.

        Return
        ------
        str
            Registry key
        ZVisualStudiorrrrrvisualstudios
zRegistryInfo.visualstudiocCst|jdS)z
        Microsoft Visual Studio SxS registry key.

        Return
        ------
        str
            Registry key
        ZSxS)rrrrrrsxss
zRegistryInfo.sxscCst|jdS)z|
        Microsoft Visual C++ VC7 registry key.

        Return
        ------
        str
            Registry key
        ZVC7rrrrrrvcs
zRegistryInfo.vccCst|jdS)z
        Microsoft Visual Studio VS7 registry key.

        Return
        ------
        str
            Registry key
        ZVS7rrrrrvss
zRegistryInfo.vscCsdS)z
        Microsoft Visual C++ for Python registry key.

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

        Return
        ------
        str
            Registry key
        zMicrosoft SDKsrrrrr
microsoft_sdk4s
zRegistryInfo.microsoft_sdkcCst|jdS)z
        Microsoft Windows/Platform SDK registry key.

        Return
        ------
        str
            Registry key
        r
rrrrrrwindows_sdk@s
zRegistryInfo.windows_sdkcCst|jdS)z
        Microsoft .NET Framework SDK registry key.

        Return
        ------
        str
            Registry key
        ZNETFXSDKrrrrr	netfx_sdkLs
zRegistryInfo.netfx_sdkcCsdS)z
        Microsoft Windows Kits Roots registry key.

        Return
        ------
        str
            Registry key
        zWindows Kits\Installed Rootsrrrrrwindows_kits_rootsXs
zRegistryInfo.windows_kits_rootsFcCs$|js|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)rrr)rr!r$Znode64rrr	microsoftdszRegistryInfo.microsoftc	
Cstj}tj}tj}|j}|jD]}d}z||||d|}Wn`ttfk
r|j	sz||||dd|}Wqttfk
rYYqYqXnYqYnXz8zt
||dWW"Sttfk
rYnXW5|r||XqdS)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)rr7r6ZCloseKeyrHKEYSr8IOErrorrrQueryValueEx)	rr!nameZkey_readZopenkeyZclosekeymshkeybkeyrrrlookupws*



zRegistryInfo.lookupN)F)rrrrrrrrrrrrrrrrrrrrrrrrrrrrs6









rc@s<eZdZdZeddZeddZedeZd7ddZ	d	d
Z
ddZd
dZe
ddZeddZeddZddZddZeddZeddZeddZedd Zed!d"Zed#d$Zed%d&Zed'd(Zed)d*Zed+d,Zed-d.Zed/d0Zed1d2Z d3d4Z!e
d8d5d6Z"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.
    WinDirrrFrENcCs2||_|jj|_||_|p$||_|_dSr)rirfind_programdata_vs_versknown_vs_paths_find_latest_available_vs_vervs_vervc_ver)rZ
registry_inforrrrrs



zSystemInfo.__init__cCs>|}|s|jstjdt|}||jt|dS)zm
        Find the latest VC version

        Return
        ------
        float
            version
        z%No Microsoft Visual C++ version foundr])find_reg_vs_versrr&r'r(setupdatesorted)rZreg_vc_versZvc_versrrrrs	
z(SystemInfo._find_latest_available_vs_vercCs.|jj}|jj|jj|jjf}g}t|jj|D]\}}zt	|||dtj
}Wnttfk
rpYq2YnX|t
|\}}}	t|D]@}
tt,tt||
d}||kr||W5QRXqt|D]>}
tt*tt||
}||kr||W5QRXqW5QRXq2t|S)z
        Find Microsoft Visual Studio versions available in registry.

        Return
        ------
        list of float
            Versions
        r)rrrrrr9productrrr6r7r8rZQueryInfoKeyrange
contextlibsuppressr)r>r;appendEnumKeyr)rrZvckeysZvs_versrr!rZsubkeysvaluesrcrBr-rrrrs*	

"zSystemInfo.find_reg_vs_versc	Csi}d}zt|}Wnttfk
r0|YSX|D]}z\t||d}t|ddd}t|}W5QRX|d}tt|d||||d<Wq6tttfk
rYq6Yq6Xq6|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.jsonrtzutf-8)rKrG
VC\Tools\MSVCZinstallationVersion)	rr8rrrjsonload_as_float_versionr)	rZvs_versionsZ
instances_dirZhashed_namesrZ
state_pathZ
state_filestateZvs_pathrrrrs*

z#SystemInfo.find_programdata_vs_verscCstd|dddS)z
        Return a string version as a simplified float version (major.minor)

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

        Return
        ------
        float
            version
        .N)r>rsplit)r rrrrszSystemInfo._as_float_versioncCs.t|jd|j}|j|jjd|jp,|S)zp
        Microsoft Visual Studio directory.

        Return
        ------
        str
            path
        zMicrosoft Visual Studio %0.1f%0.1f)rProgramFilesx86rrrr)rdefaultrrrVSInstallDir)szSystemInfo.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()rrVmsgrrrVCInstallDir:s

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

        Return
        ------
        str
            path
        rzrrr]N)rrrrrrrrr8r
IndexError)rZvs_dirZguess_vcrrrrrLs	

zSystemInfo._guess_vccCsbt|jd|j}t|jjd|j}|j|d}|rBt|dn|}|j|jjd|jp`|S)z{
        Locate Visual C++ for versions prior to 2017.

        Return
        ------
        str
            path
        z Microsoft Visual Studio %0.1f\VCrrrL)rrrrrrr)rrZreg_pathZ	python_vcZ
default_vcrrrrjs	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
        r)z7.0z6.1z6.0ar)z7.1z7.0a&@)z8.0z8.0a(@)8.1z8.1arz)z10.0rNrrrrrWindowsSdkVersion~s





zSystemInfo.WindowsSdkVersioncCs|t|jdS)zt
        Microsoft Windows SDK last version.

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

        Return
        ------
        str
            path
        rzv%sinstallationfolderrrZWinSDKNrzMicrosoft SDKs\Windows Kits\%szMicrosoft SDKs\Windows\v%sZPlatformSDK)rrrrrrrrrfindrFr)rsdkdirr-locrVinstall_baseZintverdrrrrs6

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

        Return
        ------
        str
            path
        r#r(rTF)rXrzWinSDK-NetFx%dTools%sr-rzzv%sArN)rrrrlNetFxSdkVersionrrrrrr)	rZnetfxverr.rZfxZregpathsr-rVZexecpathrrrWindowsSDKExecutablePaths"



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

        Return
        ------
        str
            path
        z%0.1f\Setup\F#r"r)rrrrr)rrVrrrFSharpInstallDirs
zSystemInfo.FSharpInstallDircCsF|jdkrdnd}|D]*}|j|jjd|}|r|p:dSqdS)zt
        Microsoft Universal CRT SDK directory.

        Return
        ------
        str
            path
        rz)10Z81rz
kitsroot%srN)rrrr)rversr-rrrrUniversalCRTSdkDirszSystemInfo.UniversalCRTSdkDircCs|t|jdS)z
        Microsoft Universal C Runtime SDK last version.

        Return
        ------
        str
            version
        r)rrrrrrrUniversalCRTSdkLastVersions
z%SystemInfo.UniversalCRTSdkLastVersioncCs|jdkrdSdS)z
        Microsoft .NET Framework SDK versions.

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

        Return
        ------
        str
            path
        rZkitsinstallationfolder)rrrrr)rrr-rrrrNetFxSdkDir*s

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

        Return
        ------
        str
            path
        zMicrosoft.NET\FrameworkZframeworkdir32rrrrrrZguess_fwrrrFrameworkDir32<szSystemInfo.FrameworkDir32cCs"t|jd}|j|jjdp |S)zw
        Microsoft .NET Framework 64bit directory.

        Return
        ------
        str
            path
        zMicrosoft.NET\Framework64Zframeworkdir64rrrrrFrameworkDir64LszSystemInfo.FrameworkDir64cCs
|dS)z
        Microsoft .NET Framework 32bit versions.

        Return
        ------
        tuple of str
            versions
         _find_dot_net_versionsrrrrFrameworkVersion32\s
zSystemInfo.FrameworkVersion32cCs
|dS)z
        Microsoft .NET Framework 64bit versions.

        Return
        ------
        tuple of str
            versions
        @rrrrrFrameworkVersion64hs
zSystemInfo.FrameworkVersion64cCs|j|jjd|}t|d|}|p6||dp6d}|jdkrJ|dfS|jdkrt|dd	d
krldn|dfS|jd
krdS|jdkrdSdS)z
        Find Microsoft .NET Framework versions.

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

        Return
        ------
        tuple of str
            versions
        zframeworkver%dzFrameworkDir%drCrrzv4.0rNrZv4z
v4.0.30319v3.5r)r
v2.0.50727g @)zv3.0r)rrrgetattrrrrg)rbitsZreg_verZdot_net_dirr-rrrrts

 

z!SystemInfo._find_dot_net_versionscs*fddttD}t|dp(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|VqdSr)rr
startswith)rhZdir_namerVprefixrrrps
z0SystemInfo._use_last_dir_name.<locals>.<genexpr>Nr)reversedrnext)rVrZ
matching_dirsrrrrs
zSystemInfo._use_last_dir_name)N)r)#rrrrrrNrrFrrrrrstaticmethodrrrrrrrrrrrrrrrrrrrrrrrrrrsZ


*





*
"








rc@sTeZdZdZd=ddZeddZedd	Zed
dZedd
Z	eddZ
eddZeddZeddZ
eddZeddZeddZddZeddZed d!Zed"d#Zed$d%Zed&d'Zed(d)Zed*d+Zed,d-Zed.d/Zed0d1Zed2d3Zed4d5Zed6d7Zd>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)
rrrrrsirr&r'r()rr.rZ
vc_min_vererrrrrrs

zEnvironmentInfo.__init__cCs|jjS)zk
        Microsoft Visual Studio.

        Return
        ------
        float
            version
        )rrrrrrrs
zEnvironmentInfo.vs_vercCs|jjS)zp
        Microsoft Visual C++ version.

        Return
        ------
        float
            version
        )rrrrrrrs
zEnvironmentInfo.vc_vercsVddg}jdkrDjjddd}|dg7}|dg7}|d|g7}fd	d
|DS)zu
        Microsoft Visual Studio Tools.

        Return
        ------
        list of str
            paths
        zCommon7\IDEz
Common7\ToolsrzTrrXz1Common7\IDE\CommonExtensions\Microsoft\TestWindowzTeam Tools\Performance ToolszTeam Tools\Performance Tools%scsg|]}tjj|qSrrrrrhrVrrr
<listcomp>sz+EnvironmentInfo.VSTools.<locals>.<listcomp>)rrr)rpathsarch_subdirrrrVSToolss



zEnvironmentInfo.VSToolscCst|jjdt|jjdgS)z
        Microsoft Visual C++ & Microsoft Foundation Class Includes.

        Return
        ------
        list of str
            paths
        IncludezATLMFC\Includerrrrrrr
VCIncludess
zEnvironmentInfo.VCIncludescsbjdkrjjdd}njjdd}d|d|g}jdkrP|d|g7}fd	d
|DS)z
        Microsoft Visual C++ & Microsoft Foundation Class Libraries.

        Return
        ------
        list of str
            paths
        .@TrXrLib%szATLMFC\Lib%srzzLib\store%scsg|]}tjj|qSrrrrrrr
sz/EnvironmentInfo.VCLibraries.<locals>.<listcomp>)rrr)rrrrrrVCLibrariess


zEnvironmentInfo.VCLibrariescCs|jdkrgSt|jjdgS)z
        Microsoft Visual C++ store references Libraries.

        Return
        ------
        list of str
            paths
        rzzLib\store\references)rrrrrrrrVCStoreRefss

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

        Return
        ------
        list of str
            paths
        Z
VCPackagesrTFBin%srzrrz
bin\HostX86%sz
bin\HostX64%srBin)rrrrrrrrrrr)rrtoolsrrrVZhost_dirrrrVCTools(s0



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

        Return
        ------
        list of str
            paths
        rTr
rrrz%sum%sN)rrrrrr_sdk_subdir)rrrZlibverrrrOSLibrariesMs

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

        Return
        ------
        list of str
            paths
        includerglrzrz%ssharedz%sumz%swinrtN)rrrrr)rr sdkverrrr
OSIncludesas


zEnvironmentInfo.OSIncludescCst|jjd}g}|jdkr&||j7}|jdkr@|t|dg7}|jdkr||t|jjdt|ddt|d	dt|d
dt|jjddd
|jdddg7}|S)z}
        Microsoft Windows SDK Libraries Paths.

        Return
        ------
        list of str
            paths
        Z
ReferencesrrzCommonConfiguration\NeutralrzZ
UnionMetadataz'Windows.Foundation.UniversalApiContractz1.0.0.0z%Windows.Foundation.FoundationContractz,Windows.Networking.Connectivity.WwanContractZ
ExtensionSDKszMicrosoft.VCLibsrZCommonConfigurationZneutral)rrrrr)rreflibpathrrr	OSLibpathys@




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

        Return
        ------
        list of str
            paths
        )list
_sdk_toolsrrrrSdkToolss
zEnvironmentInfo.SdkToolsccs|jdkr,|jdkrdnd}t|jj|V|js\|jjdd}d|}t|jj|V|jdkr|jrvd	}n|jjddd
}d|}t|jj|VnB|jdkrt|jjd}|jjdd}|jj}t|d||fV|jj	r|jj	Vd
S)z
        Microsoft Windows SDK Tools paths generator.

        Return
        ------
        generator of str
            paths
        rrrzBin\x86Trr)rrrr
zBin\NETFX 4.0 Tools%sz%s%sN)
rrrrrrrrrr)rbin_dirrrVr"rrrr(s(	




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

        Return
        ------
        str
            subdir
        %s\r)rrrucrtverrrrrs
zEnvironmentInfo._sdk_subdircCs|jdkrgSt|jjdgS)zs
        Microsoft Windows SDK Setup.

        Return
        ------
        list of str
            paths
        rSetup)rrrrrrrrSdkSetups

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

        Return
        ------
        list of str
            paths
        rTrZcsg|]}tj|qSr)rrrhr-rrrr
sz+EnvironmentInfo.FxTools.<locals>.<listcomp>csg|]}tj|qSr)rrr0r1rrr
s)	rrrrrrrrr)rrZ	include32Z	include64rrr1rFxToolss"

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

        Return
        ------
        list of str
            paths
        rzTrzlib\um%s)rrrrrr)rrrrrNetFxSDKLibrariess
z!EnvironmentInfo.NetFxSDKLibrariescCs&|jdks|jjsgSt|jjdgS)z}
        Microsoft .Net Framework SDK Includes.

        Return
        ------
        list of str
            paths
        rzz
include\um)rrrrrrrrNetFxSDKIncludess
z EnvironmentInfo.NetFxSDKIncludescCst|jjdgS)z
        Microsoft Visual Studio Team System Database.

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

        Return
        ------
        list of str
            paths
        rrTrrzMSBuild\%0.1f\bin%sZRoslyn)rrrrrrr)r	base_pathrrVbuildrrrMSBuild0s



zEnvironmentInfo.MSBuildcCs|jdkrgSt|jjdgS)zt
        Microsoft HTML Help Workshop.

        Return
        ------
        list of str
            paths
        rzHTML Help Workshop)rrrrrrrrHTMLHelpWorkshopLs

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

        Return
        ------
        list of str
            paths
        rzTrrz%sucrt%s)rrrrrr_ucrt_subdir)rrrr-rrr
UCRTLibraries[s

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

        Return
        ------
        list of str
            paths
        rzr z%sucrt)rrrrr:)rr rrrUCRTIncludesms

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

        Return
        ------
        str
            subdir
        r+r)rrr,rrrr:}s
zEnvironmentInfo._ucrt_subdircCs(d|jkrdkrnngS|jjgS)zk
        Microsoft Visual F#.

        Return
        ------
        list of str
            paths
        rr)rrrrrrrFSharps
zEnvironmentInfo.FSharpc
Csd|j}|jjddd}g}|jj}t|dd}t|rft	|t
|d}||t	|dg7}|t	|d	g7}d
|jdd
t|jdf}t
||D]&\}}t	||||}	t|	r|	SqdS)
z
        Microsoft Visual C++ runtime redistributable dll.

        Return
        ------
        str
            path
        zvcruntime%d0.dllTrrz\Toolsz\Redistr]Zonecorer[zMicrosoft.VC%d.CRT
N)rrrrRrrrrlrrrr=rr9rr)
rrdrprefixesZ
tools_pathZredist_pathZcrt_dirsrZcrt_dirrVrrrVCRuntimeRedists 

zEnvironmentInfo.VCRuntimeRedistTcCst|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}|jdkrt|jr|j|d<|S)z
        Return environment dict.

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

        Return
        ------
        dict
            environment
        r rr%rV)r rr%rVr5rq)dict_build_pathsrr#r<r4rrr2r;r3rr&rrr5r)r/r8r9r=rrr@)rexistsrxrrrr+sV	 
zEnvironmentInfo.return_envc
Csntj|}t|dt}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)r9chain
from_iterablerrNrrr'filterrupperr&r'r(r
r)
rrZspec_path_listsrCZ
spec_pathsZ	env_pathsrZextant_pathsrZunique_pathsrrrrBszEnvironmentInfo._build_paths)Nr)T)!rrrrrrrrrrrrrrr#r&r)r(rr/r2r3r4r5r8r9r;r<r:r=r@r+rBrrrrr*sj
	







$


#
#












"
2r*)r$)r)1rriorosrros.pathrrrrr|rplatformr9rOdistutils.errorsr&Z#setuptools.extern.packaging.versionr	Z setuptools.extern.more_itertoolsr
ZmonkeyrsystemrrrAr`r'r(Z_msvc9_suppress_errorsZdistutils.msvc9compilerrrr%rDrWr^reryr{rr,rrrr*rrrr<module>s`	*
&&'$
%s:
Back to Directory File Manager