|
4 | 4 |
|
5 | 5 | from __future__ import annotations
|
6 | 6 |
|
7 |
| -import functools |
8 | 7 | import inspect
|
9 | 8 | import platform
|
10 | 9 | import sys
|
11 | 10 | import types
|
12 |
| -from importlib import import_module |
13 | 11 | from typing import Type, TypeVar, cast, overload
|
14 | 12 |
|
15 | 13 | import distutils.filelist
|
@@ -91,8 +89,6 @@ def patch_all():
|
91 | 89 | 'distutils.command.build_ext'
|
92 | 90 | ].Extension = setuptools.extension.Extension
|
93 | 91 |
|
94 |
| - patch_for_msvc_specialized_compiler() |
95 |
| - |
96 | 92 |
|
97 | 93 | def _patch_distribution_metadata():
|
98 | 94 | from . import _core_metadata
|
@@ -128,36 +124,3 @@ def patch_func(replacement, target_mod, func_name):
|
128 | 124 |
|
129 | 125 | def get_unpatched_function(candidate):
|
130 | 126 | return candidate.unpatched
|
131 |
| - |
132 |
| - |
133 |
| -def patch_for_msvc_specialized_compiler(): |
134 |
| - """ |
135 |
| - Patch functions in distutils to use standalone Microsoft Visual C++ |
136 |
| - compilers. |
137 |
| - """ |
138 |
| - from . import msvc |
139 |
| - |
140 |
| - if platform.system() != 'Windows': |
141 |
| - # Compilers only available on Microsoft Windows |
142 |
| - return |
143 |
| - |
144 |
| - def patch_params(mod_name, func_name): |
145 |
| - """ |
146 |
| - Prepare the parameters for patch_func to patch indicated function. |
147 |
| - """ |
148 |
| - repl_prefix = 'msvc14_' |
149 |
| - repl_name = repl_prefix + func_name.lstrip('_') |
150 |
| - repl = getattr(msvc, repl_name) |
151 |
| - mod = import_module(mod_name) |
152 |
| - if not hasattr(mod, func_name): |
153 |
| - raise ImportError(func_name) |
154 |
| - return repl, mod, func_name |
155 |
| - |
156 |
| - # Python 3.5+ |
157 |
| - msvc14 = functools.partial(patch_params, 'distutils._msvccompiler') |
158 |
| - |
159 |
| - try: |
160 |
| - # Patch distutils._msvccompiler._get_vc_env |
161 |
| - patch_func(*msvc14('_get_vc_env')) |
162 |
| - except ImportError: |
163 |
| - pass |
0 commit comments