Skip to content

Commit b01183c

Browse files
committed
Merge https://github.com/pypa/distutils into bugfix/distutils-34f9518ef
2 parents 34f9518 + e221581 commit b01183c

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

setuptools/_distutils/sysconfig.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -293,7 +293,9 @@ def customize_compiler(compiler): # noqa: C901
293293
Mainly needed on Unix, so we can plug in the information that
294294
varies across Unices and is stored in Python's Makefile.
295295
"""
296-
if compiler.compiler_type in ["unix", "cygwin", "mingw32"]:
296+
if compiler.compiler_type in ["unix", "cygwin"] or (
297+
compiler.compiler_type == "mingw32" and is_mingw()
298+
):
297299
_customize_macos()
298300

299301
(

setuptools/_distutils/tests/test_mingwccompiler.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
from distutils.util import split_quoted, is_mingw
44
from distutils.errors import DistutilsPlatformError, CCompilerError
5+
from distutils import sysconfig
56

67

78
class TestMingw32CCompiler:
@@ -43,3 +44,12 @@ def test_cygwincc_error(self, monkeypatch):
4344

4445
with pytest.raises(CCompilerError):
4546
distutils.cygwinccompiler.Mingw32CCompiler()
47+
48+
def test_customize_compiler_with_msvc_python(self):
49+
from distutils.cygwinccompiler import Mingw32CCompiler
50+
51+
# In case we have an MSVC Python build, but still want to use
52+
# Mingw32CCompiler, then customize_compiler() shouldn't fail at least.
53+
# https://github.com/pypa/setuptools/issues/4456
54+
compiler = Mingw32CCompiler()
55+
sysconfig.customize_compiler(compiler)

0 commit comments

Comments
 (0)