|
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 TypeVar
|
14 | 12 |
|
15 | 13 | import distutils.filelist
|
@@ -84,8 +82,6 @@ def patch_all():
|
84 | 82 | 'distutils.command.build_ext'
|
85 | 83 | ].Extension = setuptools.extension.Extension
|
86 | 84 |
|
87 |
| - patch_for_msvc_specialized_compiler() |
88 |
| - |
89 | 85 |
|
90 | 86 | def _patch_distribution_metadata():
|
91 | 87 | from . import _core_metadata
|
@@ -121,36 +117,3 @@ def patch_func(replacement, target_mod, func_name):
|
121 | 117 |
|
122 | 118 | def get_unpatched_function(candidate):
|
123 | 119 | return candidate.unpatched
|
124 |
| - |
125 |
| - |
126 |
| -def patch_for_msvc_specialized_compiler(): |
127 |
| - """ |
128 |
| - Patch functions in distutils to use standalone Microsoft Visual C++ |
129 |
| - compilers. |
130 |
| - """ |
131 |
| - from . import msvc |
132 |
| - |
133 |
| - if platform.system() != 'Windows': |
134 |
| - # Compilers only available on Microsoft Windows |
135 |
| - return |
136 |
| - |
137 |
| - def patch_params(mod_name, func_name): |
138 |
| - """ |
139 |
| - Prepare the parameters for patch_func to patch indicated function. |
140 |
| - """ |
141 |
| - repl_prefix = 'msvc14_' |
142 |
| - repl_name = repl_prefix + func_name.lstrip('_') |
143 |
| - repl = getattr(msvc, repl_name) |
144 |
| - mod = import_module(mod_name) |
145 |
| - if not hasattr(mod, func_name): |
146 |
| - raise ImportError(func_name) |
147 |
| - return repl, mod, func_name |
148 |
| - |
149 |
| - # Python 3.5+ |
150 |
| - msvc14 = functools.partial(patch_params, 'distutils._msvccompiler') |
151 |
| - |
152 |
| - try: |
153 |
| - # Patch distutils._msvccompiler._get_vc_env |
154 |
| - patch_func(*msvc14('_get_vc_env')) |
155 |
| - except ImportError: |
156 |
| - pass |
0 commit comments