3 ՔRe @ 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 ddZdd Zdd Zd!ddZG dd dZG dd dZG dd dZG dd dZ 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_unpatchedWindows)winregc @ s e Zd ZdZdZdZdZdS )r N)__name__ __module____qualname__ HKEY_USERSHKEY_CURRENT_USERHKEY_LOCAL_MACHINEHKEY_CLASSES_ROOT r r /builddir/build/BUILDROOT/alt-python36-setuptools-38.5.2-7.el9.x86_64/opt/alt/python36/lib/python3.6/site-packages/setuptools/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 |rtjjjj|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 get_valueKeyErrorospathjoinisfiler msvc9_find_vcvarsall)versionZVC_BASEkey 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 distutilserrorsDistutilsPlatformError ValueErrorEnvironmentInfo return_env_augment_exception)verarchargskwargsorigexcr r r r j s r c C sn yt t| S tjjk r$ Y nX yt| ddj 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&