Skip to content

Commit 4e4e23c

Browse files
committed
Remove monkeypatching of _msvccompiler.
The monkeypatch indicates that the functionality was ported from Python 3.8, so the version in distutils should be adequate now.
1 parent 4c990b9 commit 4e4e23c

File tree

2 files changed

+0
-1787
lines changed

2 files changed

+0
-1787
lines changed

setuptools/monkey.py

-37
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,10 @@
44

55
from __future__ import annotations
66

7-
import functools
87
import inspect
98
import platform
109
import sys
1110
import types
12-
from importlib import import_module
1311
from typing import TypeVar
1412

1513
import distutils.filelist
@@ -84,8 +82,6 @@ def patch_all():
8482
'distutils.command.build_ext'
8583
].Extension = setuptools.extension.Extension
8684

87-
patch_for_msvc_specialized_compiler()
88-
8985

9086
def _patch_distribution_metadata():
9187
from . import _core_metadata
@@ -121,36 +117,3 @@ def patch_func(replacement, target_mod, func_name):
121117

122118
def get_unpatched_function(candidate):
123119
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

Comments
 (0)