|
3 | 3 |
|
4 | 4 | Known supported compilers: |
5 | 5 | -------------------------- |
6 | | -Microsoft Visual C++ 9.0: |
7 | | - Microsoft Visual C++ Compiler for Python 2.7 (x86, amd64) |
8 | | - Microsoft Windows SDK 6.1 (x86, x64, ia64) |
9 | | - Microsoft Windows SDK 7.0 (x86, x64, ia64) |
10 | | -
|
11 | | -Microsoft Visual C++ 10.0: |
12 | | - Microsoft Windows SDK 7.1 (x86, x64, ia64) |
13 | | -
|
14 | 6 | Microsoft Visual C++ 14.X: |
15 | 7 | Microsoft Visual C++ Build Tools 2015 (x86, x64, arm) |
16 | 8 | Microsoft Visual Studio Build Tools 2017 (x86, x64, arm, arm64) |
@@ -48,100 +40,6 @@ class winreg: |
48 | 40 |
|
49 | 41 | environ = dict() |
50 | 42 |
|
51 | | -_msvc9_suppress_errors = ( |
52 | | - # msvc9compiler isn't available on some platforms |
53 | | - ImportError, |
54 | | - |
55 | | - # msvc9compiler raises DistutilsPlatformError in some |
56 | | - # environments. See #1118. |
57 | | - distutils.errors.DistutilsPlatformError, |
58 | | -) |
59 | | - |
60 | | -try: |
61 | | - from distutils.msvc9compiler import Reg |
62 | | -except _msvc9_suppress_errors: |
63 | | - pass |
64 | | - |
65 | | - |
66 | | -def msvc9_find_vcvarsall(version): |
67 | | - """ |
68 | | - Patched "distutils.msvc9compiler.find_vcvarsall" to use the standalone |
69 | | - compiler build for Python |
70 | | - (VCForPython / Microsoft Visual C++ Compiler for Python 2.7). |
71 | | -
|
72 | | - Fall back to original behavior when the standalone compiler is not |
73 | | - available. |
74 | | -
|
75 | | - Redirect the path of "vcvarsall.bat". |
76 | | -
|
77 | | - Parameters |
78 | | - ---------- |
79 | | - version: float |
80 | | - Required Microsoft Visual C++ version. |
81 | | -
|
82 | | - Return |
83 | | - ------ |
84 | | - str |
85 | | - vcvarsall.bat path |
86 | | - """ |
87 | | - vc_base = r'Software\%sMicrosoft\DevDiv\VCForPython\%0.1f' |
88 | | - key = vc_base % ('', version) |
89 | | - try: |
90 | | - # Per-user installs register the compiler path here |
91 | | - productdir = Reg.get_value(key, "installdir") |
92 | | - except KeyError: |
93 | | - try: |
94 | | - # All-user installs on a 64-bit system register here |
95 | | - key = vc_base % ('Wow6432Node\\', version) |
96 | | - productdir = Reg.get_value(key, "installdir") |
97 | | - except KeyError: |
98 | | - productdir = None |
99 | | - |
100 | | - if productdir: |
101 | | - vcvarsall = join(productdir, "vcvarsall.bat") |
102 | | - if isfile(vcvarsall): |
103 | | - return vcvarsall |
104 | | - |
105 | | - return get_unpatched(msvc9_find_vcvarsall)(version) |
106 | | - |
107 | | - |
108 | | -def msvc9_query_vcvarsall(ver, arch='x86', *args, **kwargs): |
109 | | - """ |
110 | | - Patched "distutils.msvc9compiler.query_vcvarsall" for support extra |
111 | | - Microsoft Visual C++ 9.0 and 10.0 compilers. |
112 | | -
|
113 | | - Set environment without use of "vcvarsall.bat". |
114 | | -
|
115 | | - Parameters |
116 | | - ---------- |
117 | | - ver: float |
118 | | - Required Microsoft Visual C++ version. |
119 | | - arch: str |
120 | | - Target architecture. |
121 | | -
|
122 | | - Return |
123 | | - ------ |
124 | | - dict |
125 | | - environment |
126 | | - """ |
127 | | - # Try to get environment from vcvarsall.bat (Classical way) |
128 | | - try: |
129 | | - orig = get_unpatched(msvc9_query_vcvarsall) |
130 | | - return orig(ver, arch, *args, **kwargs) |
131 | | - except distutils.errors.DistutilsPlatformError: |
132 | | - # Pass error if Vcvarsall.bat is missing |
133 | | - pass |
134 | | - except ValueError: |
135 | | - # Pass error if environment not set after executing vcvarsall.bat |
136 | | - pass |
137 | | - |
138 | | - # If error, try to set environment directly |
139 | | - try: |
140 | | - return EnvironmentInfo(arch, ver).return_env() |
141 | | - except distutils.errors.DistutilsPlatformError as exc: |
142 | | - _augment_exception(exc, ver, arch) |
143 | | - raise |
144 | | - |
145 | 43 |
|
146 | 44 | def _msvc14_find_vc2015(): |
147 | 45 | """Python 3.8 "distutils/_msvccompiler.py" backport""" |
|
0 commit comments