Skip to main content
Glama

API Docs MCP Server

msvc.cpython-310.pyc42.7 kB
o ��g���@s�dZddlZddlmZddlmZmZddlmZm Z m Z m Z ddl Z ddl Z ddlZddlZddlZddlZddlmZddlmZdd lmZe��d kr[ddlZdd lmZn Gd d �d �Ze�ZeejjfZ zddl!m"Z"Wn e y|Ynwdd�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�]C:\Users\apqls\Documents\Github\tkbase\api-docs-mcp\venv\Lib\site-packages\setuptools/msvc.pyr+s r)�Regc Cs�d}|d|f}zt�|d�}Wn#ty3z|d|f}t�|d�}Wn ty0d}YnwYnw|rAt|d�}t|�rA|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_value�KeyErrorrrr �msvc9_find_vcvarsall)�versionZvc_base�key� productdir� vcvarsallrrrrBs$    ���  r�x86c Os�ztt�}|||g|�Ri|��WStjjyYn ty$Ynwzt||���WStjjyB}zt|||��d}~ww)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%c Cszt�tjddtjtjB�}Wn tyYdSwd}d}|�^t��D]D}z t�||�\}}}Wn ty<Yqtw|ri|tj krit |�rizt t |��}Wn t tfy[Yq%w|dkri||kri||}}q%Wd�||fSWd�||fS1s�wY||fS)�0Python 3.8 "distutils/_msvccompiler.py" backportz'Software\Microsoft\VisualStudio\SxS\VC7r�NNN�)r�OpenKeyr�KEY_READ�KEY_WOW64_32KEY�OSError� itertools�count� EnumValue�REG_SZr�int�floatr)� TypeError)r!� best_version�best_dir�i�vZvc_dirZvtr rrr�_msvc14_find_vc2015�sH � �  �� �� � � � � rEcCs�t�d�p t�d�}|sdSzt�t|ddd�ddd d d d d d dddg �jddd���}Wntjtt fy;YdSwt|ddd�}t |�rKd|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. �ProgramFiles(x86)� ProgramFilesr4zMicrosoft Visual StudioZ Installerz vswhere.exez-latestz -prereleasez -requiresAnyz -requiresz1Microsoft.VisualStudio.Component.VC.Tools.x86.x64z)Microsoft.VisualStudio.Workload.WDExpressz -property�installationPathz -products�*�mbcs�strict)�encodingr'�VCZ AuxiliaryZBuild�N) r�get� subprocess� check_outputr�decode�strip�CalledProcessErrorr9�UnicodeDecodeErrorr)�root�pathrrr�_msvc14_find_vc2017�s2  � � � �rX�x64�arm�arm64)r$Z x86_amd64Zx86_armZ x86_arm64c Cs�t�\}}d}|tvrt|}nd|vrdnd}|rDt|ddddd|d d � }zd dl}|j|d d �d}WntttfyCd}Ynw|sUt�\}}|rUt|d|dd �}|sYdSt|d�}t|�sddS|rjt|�sld}||fS)r3N�amd64rYr$z..�redistZMSVCz**zMicrosoft.VC14*.CRTzvcruntime140.dllrT)� recursive�����zMicrosoft.VC140.CRTr4r) rX�PLAT_SPEC_TO_RUNTIMEr�glob� ImportErrorr9� LookupErrorrEr) � plat_spec�_rB� vcruntimeZvcruntime_platZvcredistrarAr#rrr�_msvc14_find_vcvarsall�s<  �� �  rgc Cs�dtvr dd�t��D�St|�\}}|stj�d��ztjd�||�tj d�j ddd �}Wntj yF}z tj�d �|j ��|�d }~wwd d�d d�|� �D�D�}|r[||d<|S)r3ZDISTUTILS_USE_SDKcSsi|] \}}|��|�qSr��lower)�.0r!�valuerrr� <dictcomp>s��z&_msvc14_get_vc_env.<locals>.<dictcomp>zUnable to find vcvarsall.batzcmd /u /c "{}" {} && set)�stderrzutf-16le�replace)r'zError executing {}NcSs$i|]\}}}|r|r|��|�qSrrh)rjr!rerkrrrrls���css�|]}|�d�VqdS)�=N)� partition)rj�linerrr� <genexpr>s�z%_msvc14_get_vc_env.<locals>.<genexpr>�py_vcruntime_redist)r�itemsrgr&r'r(rPrQ�format�STDOUTrRrT�cmd� splitlines)rdr#rf�outr2�envrrr�_msvc14_get_vc_envs<� � � � �����r{c Cs4zt|�WStjjy}zt|d��d}~ww)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)r{r&r'r(r,)rdr2rrr�msvc14_get_vc_env(s  ��r}cOsJdtjvrddl}t|j�td�kr|jjj|i|��Stt �|i|��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/r0�nprrrr�Bs r�rcCs�|jd}d|��vsd|��vrLd}|jdit���}d}|dkr5|���d�dkr0|d 7}n|d 7}n|d krD|d 7}||d 7}n|dkrL|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 r|zd Get it with "Microsoft C++ Build Tools": https://visualstudio.microsoft.com/visual-cpp-build-tools/Nr)r/riru�locals�find)r2r r.�message�tmplZ msdownloadrrrr,Os    r,c@sbeZdZdZe�dd���Zdd�Ze dd��Z dd �Z d d �Z dd d�Z ddd�Zddd�ZdS)� PlatformInfoz� Current and Target Architectures information. Parameters ---------- arch: str Target architecture. Zprocessor_architecturercCs|���dd�|_dS)NrYr\)rirnr.)�selfr.rrr�__init__szPlatformInfo.__init__cCs|j|j�d�dd�S)zs Return Target CPU architecture. Return ------ str Target CPU rer N)r.r��r�rrr� target_cpu�s zPlatformInfo.target_cpucC� |jdkS)z� Return True if target CPU is x86 32 bits.. Return ------ bool CPU is x86 32 bits r$N�r�r�rrr� target_is_x86�� zPlatformInfo.target_is_x86cCr�)z� Return True if current CPU is x86 32 bits.. Return ------ bool CPU is x86 32 bits r$N�� current_cpur�rrr�current_is_x86�r�zPlatformInfo.current_is_x86FcC�.|jdkr |r dS|jdkr|rdSd|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$rr\�\x64�\%sNr��r��hidex86rYrrr� current_dir�� ���zPlatformInfo.current_dircCr�)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$rr\r�r�Nr�r�rrr� target_dir�r�zPlatformInfo.target_dircCs0|rdn|j}|j|krdS|���dd|�S)ap Cross platform specific subfolder. Parameters ---------- forcex86: bool Use 'x86' as current architecture even if current architecture is not x86. Return ------ str subfolder: '' if target architecture is current architecture, '\current_target' if not. r$r�\z\%s_N)r�r�r�rn)r��forcex86�currentrrr� cross_dir�s  ��zPlatformInfo.cross_dirN)FF�F)rrr�__doc__rrOrir�r��propertyr�r�r�r�r�r�rrrrr�ts   r�c@s�eZdZdZejejejejfZ dd�Z e dd��Z e dd��Z e dd ��Ze d d ��Ze d d ��Ze dd��Ze dd��Ze dd��Ze dd��Zddd�Zdd�ZdS)� RegistryInfoz� Microsoft Visual Studio related registry information. Parameters ---------- platform_info: PlatformInfo "PlatformInfo" instance. cCs ||_dS�N)�pi)r�Z platform_inforrrr��s zRegistryInfo.__init__cC�dS)z� Microsoft Visual Studio root registry key. Return ------ str Registry key Z VisualStudioNrr�rrr� visualstudio�� zRegistryInfo.visualstudiocC� t|jd�S)z Microsoft Visual Studio SxS registry key. Return ------ str Registry key ZSxSN)rr�r�rrr�sxs� zRegistryInfo.sxscCr�)z| Microsoft Visual C++ VC7 registry key. Return ------ str Registry key ZVC7N�rr�r�rrr�vcr�zRegistryInfo.vccCr�)z Microsoft Visual Studio VS7 registry key. Return ------ str Registry key ZVS7Nr�r�rrr�vsr�zRegistryInfo.vscCr�)z� Microsoft Visual C++ for Python registry key. Return ------ str Registry key zDevDiv\VCForPythonNrr�rrr� vc_for_python(r�zRegistryInfo.vc_for_pythoncCr�)zq Microsoft SDK registry key. Return ------ str Registry key zMicrosoft SDKsNrr�rrr� microsoft_sdk4r�zRegistryInfo.microsoft_sdkcCr�)z� Microsoft Windows/Platform SDK registry key. Return ------ str Registry key r N�rr�r�rrr� windows_sdk@r�zRegistryInfo.windows_sdkcCr�)z� Microsoft .NET Framework SDK registry key. Return ------ str Registry key ZNETFXSDKNr�r�rrr� netfx_sdkLr�zRegistryInfo.netfx_sdkcCr�)z� Microsoft Windows Kits Roots registry key. Return ------ str Registry key zWindows Kits\Installed RootsNrr�rrr�windows_kits_rootsXr�zRegistryInfo.windows_kits_rootsFcCs$|j��s|r dnd}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 rZ Wow6432NodeZSoftware� MicrosoftN)r�r�r)r�r!r$Znode64rrr� microsoftdszRegistryInfo.microsoftc Cs�tj}tj}tj}|j}|jD]l}d}z ||||�d|�}Wn+ttfyI|j� �sEz ||||d�d|�}WnttfyDYYqwYqYnwz)zt� ||�dWW|r^||�SSttfykYnwW|rs||�q|r{||�wwdS)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) rr7r6�CloseKeyr��HKEYSr9�IOErrorr�r�� QueryValueEx) r�r!�nameZkey_readZopenkeyZclosekey�ms�hkey�bkeyrrr�lookupwsD  �������� ��zRegistryInfo.lookupNr�)rrrr�rrrrrr�r�r�r�r�r�r�r�r�r�r�r�r�r�rrrrr��s8�          r�c@s<eZdZdZe�dd�Ze�dd�Ze�de�Zd7dd�Z d d �Z d d �Z d 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. �WinDirrrGrFNcCs2||_|jj|_|��|_|p|��|_|_dSr�)�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 foundr_N)�find_reg_vs_versr�r&r'r(�set�update�sorted)r�Z reg_vc_versZvc_versrrrr��s �  z(SystemInfo._find_latest_available_vs_verc Csb|jj}|jj|jj|jjf}g}t�|jj|�D]�\}}z t� |||�dtj �}Wn t t fy5Yqw|�lt� |�\}}} t|�D]*} t�t��tt�|| �d�} | |vr`|�| �Wd�qE1sjwYqEt|�D](} t�t��tt�|| ��} | |vr�|�| �Wd�qt1s�wYqtWd�q1s�wYqt|�S)z� Find Microsoft Visual Studio versions available in registry. Return ------ list of float Versions rN)r�r�r�r�r�r:�productr�rr6r7r9r�� QueryInfoKey�range� contextlib�suppressr)r?r<�append�EnumKeyr�) r�r�ZvckeysZvs_versr�r!r�Zsubkeys�valuesrerCr-rrrr��s8 �   ��   ���� zSystemInfo.find_reg_vs_versc Cs�i}d}zt|�}Wn ttfy|YSw|D]F}z8t||d�}t|ddd�� }t�|�}Wd�n1s:wY|d}tt|d��|||�|d �<Wqtttfy`Yqw|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)rLNrH� VC\Tools\MSVCZinstallationVersion) rr9r�rr�json�load�_as_float_versionr) r�Z vs_versionsZ instances_dirZ hashed_namesr�Z state_pathZ state_file�stateZvs_pathrrrr��s0 � �  ����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)r rrrr�szSystemInfo._as_float_versioncCs.t|jd|j�}|j�|jjd|j�p|S)zp Microsoft Visual Studio directory. Return ------ str path zMicrosoft Visual Studio %0.1f�%0.1fN)r�ProgramFilesx86r�r�r�r�)r��defaultrrr� VSInstallDir)s �zSystemInfo.VSInstallDircCs,|��p|��}t|�sd}tj�|��|S)zm Microsoft Visual C++ directory. Return ------ str path z(Microsoft Visual C++ directory not foundN)� _guess_vc�_guess_vc_legacyrr&r'r()r�rW�msgrrr� VCInstallDir:s   zSystemInfo.VCInstallDirc Cs�|jdkrdSz|j|j}Wn ty|j}Ynwt|d�}zt|�d}|�|�|_t||�WStt t fy@YdSw)zl Locate Visual C++ for VS2017+. Return ------ str path r|rr�r_N) r�r�rr�rrr�r�r9r�� IndexError)r�Zvs_dirZguess_vcr�rrrr�Ls   �    �zSystemInfo._guess_vccCsbt|jd|j�}t|jjd|j�}|j�|d�}|r!t|d�n|}|j�|jjd|j�p0|S)z{ Locate Visual C++ for versions prior to 2017. Return ------ str path z Microsoft Visual Studio %0.1f\VCr�rrMN)rr�r�r�r�r�r�)r�r�Zreg_pathZ python_vcZ default_vcrrrr�js �zSystemInfo._guess_vc_legacycCsJ|jdkrdS|jdkrdS|jdkrdS|jdkrdS|jd kr#d Sd S) 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.1ar|)z10.0r�N�r�r�rrr�WindowsSdkVersion~s     �zSystemInfo.WindowsSdkVersioncC�|�t|jd��S)zt Microsoft Windows SDK last version. Return ------ str version �libN)�_use_last_dir_namer� WindowsSdkDirr�rrr�WindowsSdkLastVersion�� z SystemInfo.WindowsSdkLastVersioncCs d}|jD]}t|jjd|�}|j�|d�}|rqq|r"t|�s:t|jjd|j�}|j�|d�}|r:t|d�}|r@t|�s_|jD]}|d|�d��}d |}t|j |�}t|�r^|}qC|ret|�s{|jD]}d |}t|j |�}t|�rz|}qh|s�t|j d �}|S) zn Microsoft Windows SDK directory. Return ------ str path rzv%s�installationfolderr�rZWinSDKNr�zMicrosoft SDKs\Windows Kits\%szMicrosoft SDKs\Windows\v%sZ PlatformSDK) r�rr�r�r�rr�r��rfindrGr�)r��sdkdirr-�locrW� install_baseZintver�drrrr��s< �     �   � zSystemInfo.WindowsSdkDirc Cs�|jdkr d}d}nd}|jdkrdnd}|jjd|d�}d ||�d d �f}g}|jd kr?|jD] }|t|jj||�g7}q1|jD]}|t|jj d ||�g7}qB|D]}|j� |d�}|rc|SqTdS)zy Microsoft Windows SDK executable directory. Return ------ str path r��#r�(r�TF)rYr�zWinSDK-NetFx%dTools%sr��-r|zv%sAr�N) r�r�r�rn�NetFxSdkVersionrr�r�r�r�r�) r�Znetfxverr.r�ZfxZregpathsr-rWZexecpathrrr�WindowsSDKExecutablePath�s&    ��z#SystemInfo.WindowsSDKExecutablePathcCs&t|jjd|j�}|j�|d�pdS)zl Microsoft Visual F# directory. Return ------ str path z%0.1f\Setup\F#r"rN)rr�r�r�r�)r�rWrrr�FSharpInstallDir�s zSystemInfo.FSharpInstallDircCsF|jdkrdnd}|D]}|j�|jjd|�}|r |pdSq dS)zt Microsoft Universal CRT SDK directory. Return ------ str path r|)�10Z81rz kitsroot%srN)r�r�r�r�)r��versr-r�rrr�UniversalCRTSdkDir�s  � ��zSystemInfo.UniversalCRTSdkDircCr�)z� Microsoft Universal C Runtime SDK last version. Return ------ str version r�N)r�rrr�rrr�UniversalCRTSdkLastVersionr�z%SystemInfo.UniversalCRTSdkLastVersioncCs|jdkrdSdS)z� Microsoft .NET Framework SDK versions. Return ------ tuple of str versions r|) z4.7.2z4.7.1z4.7z4.6.2z4.6.1z4.6z4.5.2z4.5.1z4.5rNr�r�rrrr�s��zSystemInfo.NetFxSdkVersioncCs:d}|jD]}t|jj|�}|j�|d�}|r|Sq|S)zu Microsoft .NET Framework SDK directory. Return ------ str path rZkitsinstallationfolderN)r�rr�r�r�)r�r�r-r�rrr� NetFxSdkDir*s �zSystemInfo.NetFxSdkDircC�"t|jd�}|j�|jjd�p|S)zw Microsoft .NET Framework 32bit directory. Return ------ str path zMicrosoft.NET\FrameworkZframeworkdir32N�rr�r�r�r��r�Zguess_fwrrr�FrameworkDir32<� zSystemInfo.FrameworkDir32cCr)zw Microsoft .NET Framework 64bit directory. Return ------ str path zMicrosoft.NET\Framework64Zframeworkdir64Nrrrrr�FrameworkDir64LrzSystemInfo.FrameworkDir64cC� |�d�S)z� Microsoft .NET Framework 32bit versions. Return ------ tuple of str versions � N��_find_dot_net_versionsr�rrr�FrameworkVersion32\� zSystemInfo.FrameworkVersion32cCr )z� Microsoft .NET Framework 64bit versions. Return ------ tuple of str versions �@Nr r�rrr�FrameworkVersion64hrzSystemInfo.FrameworkVersion64cCs�|j�|jjd|�}t|d|�}|p|�|d�pd}|jdkr%|dfS|jdkr<|��dd �d kr8d d fS|d fS|jd krCdS|jdkrJdSdS)z� Find Microsoft .NET Framework versions. Parameters ---------- bits: int Platform number of bits: 32 or 64. Return ------ tuple of str versions zframeworkver%dzFrameworkDir%drDrr�zv4.0r�Nr�Zv4z v4.0.30319�v3.5r�)r� v2.0.50727g @)zv3.0r)r�r�r��getattrr�r�ri)r��bitsZreg_verZ dot_net_dirr-rrrr ts  $  �z!SystemInfo._find_dot_net_versionscs*��fdd�tt���D�}t|d�pdS)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)rj�dir_name�rW�prefixrrrr�s� �� �z0SystemInfo._use_last_dir_name.<locals>.<genexpr>Nr)�reversedr�next)rWrZ matching_dirsrrrr��s  �zSystemInfo._use_last_dir_namer��r)#rrrr�rrOr�rGr�r�r�r�r�� staticmethodr�r�r�r�r�r�r�r�r�r�r�rrr�rrrr rr r�rrrrr��s\    *      * "          r�c@sTeZdZdZd=dd�Zedd��Zedd ��Zed d ��Zed d ��Z edd��Z edd��Z edd��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|krd}tj� |��dS)Nz.No suitable Microsoft Visual C++ version found) r�r�r�r�r��sir�r&r'r()r�r.r�Z vc_min_ver�errrrrr��s    �zEnvironmentInfo.__init__cC�|jjS)zk Microsoft Visual Studio. Return ------ float version N)rr�r�rrrr��� zEnvironmentInfo.vs_vercCr)zp Microsoft Visual C++ version. Return ------ float version N)rr�r�rrrr��r zEnvironmentInfo.vc_vercsVddg}�jdkr"�jjddd�}|dg7}|dg7}|d|g7}�fd d �|D�S) zu Microsoft Visual Studio Tools. Return ------ list of str paths z Common7\IDEz Common7\Toolsr|T�r�rYz1Common7\IDE\CommonExtensions\Microsoft\TestWindowzTeam Tools\Performance ToolszTeam Tools\Performance Tools%sc�g|] }t�jj|��qSr�rrr��rjrWr�rr� <listcomp>��z+EnvironmentInfo.VSTools.<locals>.<listcomp>N)r�r�r�)r��paths� arch_subdirrr�r�VSTools�s   zEnvironmentInfo.VSToolscCst|jjd�t|jjd�gS)z� Microsoft Visual C++ & Microsoft Foundation Class Includes. Return ------ list of str paths �IncludezATLMFC\IncludeN�rrr�r�rrr� VCIncludes�s �zEnvironmentInfo.VCIncludescsb�jdkr �jjdd�}n�jjdd�}d|d|g}�jdkr(|d|g7}�fd d �|D�S) z� Microsoft Visual C++ & Microsoft Foundation Class Libraries. Return ------ list of str paths �.@T�rY�r��Lib%sz ATLMFC\Lib%sr|z Lib\store%scr"rr+r$r�rrr%r&z/EnvironmentInfo.VCLibraries.<locals>.<listcomp>N)r�r�r�)r�r(r'rr�r� VCLibrariess  zEnvironmentInfo.VCLibrariescC�|jdkrgSt|jjd�gS)z� Microsoft Visual C++ store references Libraries. Return ------ list of str paths r|zLib\store\referencesN)r�rrr�r�rrr� VCStoreRefss zEnvironmentInfo.VCStoreRefscCs|j}t|jd�g}|jdkrdnd}|j�|�}|r&|t|jd|�g7}|jdkr?d|jjdd�}|t|j|�g7}|S|jdkrw|j��rKd nd }|t|j||jjdd ��g7}|jj |jj kru|t|j||jjdd ��g7}|S|t|jd �g7}|S)zr Microsoft Visual C++ Tools. Return ------ list of str paths Z VCPackagesr�TF�Bin%sr|r/r-z bin\HostX86%sz bin\HostX64%sr.�BinN) rrr�r�r�r�r�r�r�r�r�)r�r�toolsr�r(rWZhost_dirrrr�VCTools(s0    �����zEnvironmentInfo.VCToolscCsd|jdkr|jjddd�}t|jjd|�gS|jjdd�}t|jjd�}|j}t|d||f�gS) zw Microsoft Windows SDK Libraries. Return ------ list of str paths r�Tr!r0r.r�z%sum%sN)r�r�r�rrr�� _sdk_subdir)r�r(r�Zlibverrrr� OSLibrariesMs zEnvironmentInfo.OSLibrariescCsdt|jjd�}|jdkr|t|d�gS|jdkr|j}nd}t|d|�t|d|�t|d|�gS) zu Microsoft Windows SDK Include. Return ------ list of str paths �includer��glr|rz%ssharedz%sumz%swinrtN)rrr�r�r8)r�r:�sdkverrrr� OSIncludesas     �zEnvironmentInfo.OSIncludescCs�t|jjd�}g}|jdkr||j7}|jdkr |t|d�g7}|jdkrM||t|jjd�t|dd�t|d d�t|d d�t|jjd d d |jddd�g7}|S)z} Microsoft Windows SDK Libraries Paths. Return ------ list of str paths Z Referencesr�r�zCommonConfiguration\Neutralr|Z UnionMetadataz'Windows.Foundation.UniversalApiContractz1.0.0.0z%Windows.Foundation.FoundationContractz,Windows.Networking.Connectivity.WwanContractZ ExtensionSDKszMicrosoft.VCLibsr�ZCommonConfigurationZneutralN)rrr�r�r9)r��ref�libpathrrr� OSLibpathys2      � �  ��zEnvironmentInfo.OSLibpathcCs t|���S)zs Microsoft Windows SDK Tools. Return ------ list of str paths N)�list� _sdk_toolsr�rrr�SdkTools�r�zEnvironmentInfo.SdkToolsccs��|jdkr|jdkr dnd}t|jj|�V|j��s/|jjdd�}d|}t|jj|�V|jdvrQ|j��r<d }n|jjddd �}d |}t|jj|�Vn!|jdkrrt|jjd�}|jjdd�}|jj}t|d ||f�V|jj r}|jj Vd Sd S)z� Microsoft Windows SDK Tools paths generator. Return ------ generator of str paths r-r�r5zBin\x86Tr.r4)r�r�rr!zBin\NETFX 4.0 Tools%sz%s%sN) r�rrr�r�r�r�r�r�r�)r��bin_dirr(rWr<rrrrB�s,�     �zEnvironmentInfo._sdk_toolscC�|jj}|r d|SdS)zu Microsoft Windows SDK version subdir. Return ------ str subdir �%s\rN)rr��r��ucrtverrrrr8�� zEnvironmentInfo._sdk_subdircCs|jdkrgSt|jjd�gS)zs Microsoft Windows SDK Setup. Return ------ list of str paths r��SetupN)r�rrr�r�rrr�SdkSetup�� zEnvironmentInfo.SdkSetupcs�|j}|j�|jdkrd}|�� o|�� }n|��p|��}|jdkp)|jdk}g}|r:|�fdd��jD�7}|rH|�fdd��jD�7}|S)zv Microsoft .NET Framework Tools. Return ------ list of str paths r�Tr\c�g|]}t�j|��qSr)rr�rjr-�rrrr%���z+EnvironmentInfo.FxTools.<locals>.<listcomp>crMr)rrrNrOrrr%rPN) r�rr�r�r�r�r�r r)r�r�Z include32Z include64r6rrOr�FxTools�s"   � �zEnvironmentInfo.FxToolscCs8|jdks |jjs gS|jjdd�}t|jjd|�gS)z~ Microsoft .Net Framework SDK Libraries. Return ------ list of str paths r|Tr.zlib\um%sN)r�rrr�r�r)r�r(rrr�NetFxSDKLibrariess z!EnvironmentInfo.NetFxSDKLibrariescCs&|jdks |jjs gSt|jjd�gS)z} Microsoft .Net Framework SDK Includes. Return ------ list of str paths r|z include\umN)r�rrrr�rrr�NetFxSDKIncludess z EnvironmentInfo.NetFxSDKIncludescCst|jjd�gS)z� Microsoft Visual Studio Team System Database. Return ------ list of str paths z VSTSDB\DeployNr#r�rrr�VsTDb$s zEnvironmentInfo.VsTDbcCsv|jdkrgS|jdkr|jj}|jjdd�}n|jj}d}d|j|f}t||�g}|jdkr9|t||d�g7}|S) zn Microsoft Build Engine. Return ------ list of str paths r�r-Tr/rzMSBuild\%0.1f\bin%sZRoslynN)r�rr�r�r�r�r)r�� base_pathr(rW�buildrrr�MSBuild0s    zEnvironmentInfo.MSBuildcCr2)zt Microsoft HTML Help Workshop. Return ------ list of str paths r�zHTML Help WorkshopN)r�rrr�r�rrr�HTMLHelpWorkshopLrLz EnvironmentInfo.HTMLHelpWorkshopcCsD|jdkrgS|jjdd�}t|jjd�}|j}t|d||f�gS)z� Microsoft Universal C Runtime SDK Libraries. Return ------ list of str paths r|Tr.r�z%sucrt%sN)r�r�r�rrr� _ucrt_subdir)r�r(r�rHrrr� UCRTLibraries[s zEnvironmentInfo.UCRTLibrariescCs.|jdkrgSt|jjd�}t|d|j�gS)z� Microsoft Universal C Runtime SDK Include. Return ------ list of str paths r|r:z%sucrtN)r�rrrrY)r�r:rrr� UCRTIncludesms zEnvironmentInfo.UCRTIncludescCrE)z� Microsoft Universal C Runtime SDK version subdir. Return ------ str subdir rFrN)rrrGrrrrY}rIzEnvironmentInfo._ucrt_subdircCs$d|jkr dkr gS|jjgS)zk Microsoft Visual F#. Return ------ list of str paths r�r�N)r�rr�r�rrr�FSharp�s � zEnvironmentInfo.FSharpc Cs�d|j}|jjdd��d�}g}|jj}t|�dd��}t|�r3t |t |�d�}||t |d�g7}|t |d �g7}d |jd d t |j �d f}t �||�D]\}}t ||||�} t| �rd| SqQd S) z Microsoft Visual C++ runtime redistributable dll. Return ------ str path zvcruntime%d0.dllTr.r�z\Toolsz\Redistr_Zonecorer]zMicrosoft.VC%d.CRT� N)r�r�r�rSrr�rrnrrrr>r�r:r�r) r�rfr(�prefixesZ tools_pathZ redist_pathZcrt_dirsrZcrt_dirrWrrr�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�}|jdkrWt|j�rW|j|d<|S) z� Return environment dict. Parameters ---------- exists: bool It True, only return existing paths. Return ------ dict environment r:r�r?rW)r:r�r?rWr5rsN)�dict� _build_pathsr,r=r[rSr1r9rQrZrRr3r@r7r)rTrCrKrWrXr\r�rr_)r��existsrzrrrr+�sV������� �� zEnvironmentInfo.return_envc Csntj�|�}t�|d��t�}t�||�}|rttt |��n|}|s.d|� �}t j � |��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 emptyN)r:�chain� from_iterablerrOr�rrA�filterr�upperr&r'r(r r) r�r�Zspec_path_listsrbZ spec_pathsZ env_pathsr'Z extant_pathsr�Z unique_pathsrrrra�s     zEnvironmentInfo._build_paths)Nr)T)!rrrr�r�r�r�r�r)r,r1r3r7r9r=r@rCrBr8rKrQrRrSrTrWrXrZr[rYr\r_r+rarrrrr*�sl        $   #  #              " 2r*)r$r)1r�r��ior�osrr�os.pathrrrrr~r��platformr:rP�distutils.errorsr&Z#setuptools.extern.packaging.versionr Z setuptools.extern.more_itertoolsr Zmonkeyr �systemrrr`rbr'r(Z_msvc9_suppress_errorsZdistutils.msvc9compilerrrr%rErXr`rgr{r}r�r,r�r�r�r*rrrr�<module>sd     �  � *&&�'$ %s:

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/ShotaNagafuchi/api-docs-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server