3 ÄvhŸ ã @ s d Z ddlZddlZddlZddlZddlZddlmZ ddl m Z ddlmZ ej ƒ dkrpddl mZ ejZnG d d „ d ƒZeƒ ZeejjfZyddlmZ W n ek r´ Y nX dd „ Zd dd„Zdd„ Zdd„ Zd!dd„ZG dd„ dƒZG dd„ dƒZG dd„ dƒZG dd„ 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 e Zd ZdZdZdZdZdS )r N)Ú__name__Ú __module__Ú__qualname__Ú HKEY_USERSÚHKEY_CURRENT_USERÚHKEY_LOCAL_MACHINEÚHKEY_CLASSES_ROOT© r r ú/usr/lib/python3.6/msvc.pyr ( s r )ÚRegc C sž d}|d| f }yt j|dƒ}W nJ tk rj y|d| f }t j|dƒ}W n tk rd d}Y nX Y nX |r’tjjjj|dƒ}tjj|ƒr’|S ttƒ| ƒ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Ú Ú installdirzWow6432Node\Nz vcvarsall.bat) r Z get_valueÚKeyErrorÚosÚpathÚjoinÚisfiler Úmsvc9_find_vcvarsall)ÚversionZVC_BASEÚkeyÚ productdirÚ vcvarsallr r r r ? s r Úx86c O sŽ yt tƒ}|| |f|ž|ŽS tjjk r2 Y n tk rD Y nX yt|| ƒjƒ S tjjk rˆ } zt|| |ƒ ‚ W Y dd}~X nX dS )aœ Patched "distutils.msvc9compiler.query_vcvarsall" for support extra compilers. Set environment without use of "vcvarsall.bat". Known supported compilers ------------------------- Microsoft Visual C++ 9.0: Microsoft Visual C++ Compiler for Python 2.7 (x86, amd64) Microsoft Windows SDK 6.1 (x86, x64, ia64) Microsoft Windows SDK 7.0 (x86, x64, ia64) Microsoft Visual C++ 10.0: Microsoft Windows SDK 7.1 (x86, x64, ia64) Parameters ---------- ver: float Required Microsoft Visual C++ version. arch: str Target architecture. Return ------ environment: dict N) r Úmsvc9_query_vcvarsallÚ distutilsÚerrorsÚDistutilsPlatformErrorÚ ValueErrorÚEnvironmentInfoÚ return_envÚ_augment_exception)ÚverÚarchÚargsÚkwargsZorigÚexcr r r r j s r c C sn yt tƒ| ƒS tjjk r$ Y nX yt| dd�jƒ S tjjk rh } zt|dƒ ‚ W Y dd}~X nX dS )a' Patched "distutils._msvccompiler._get_vc_env" for support extra compilers. Set environment without use of "vcvarsall.bat". Known supported compilers ------------------------- Microsoft Visual C++ 14.0: Microsoft Visual C++ Build Tools 2015 (x86, x64, arm) Microsoft Visual Studio 2017 (x86, x64, arm, arm64) Microsoft Visual Studio Build Tools 2017 (x86, x64, arm, arm64) Parameters ---------- plat_spec: str Target architecture. Return ------ environment: dict g ,@)Ú vc_min_verN)r Úmsvc14_get_vc_envr r! r" r$ r% r&