Skip to content

Commit 4ecf617

Browse files
committed
cygwinccompiler: Get the compilers from sysconfig
On the CLANG64 environment of MSYS2, we should use clang instead of gcc. This patch gets the compiler from sysconfig which would be set when Python was built. Without this patch, the build fails when it's trying to check if the compiler is cygwin's one.
1 parent bddd259 commit 4ecf617

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

distutils/cygwinccompiler.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
DistutilsPlatformError,
2222
)
2323
from .file_util import write_file
24+
from .sysconfig import get_config_vars
2425
from .unixccompiler import UnixCCompiler
2526
from .version import LooseVersion, suppress_known_deprecation
2627

@@ -61,8 +62,12 @@ def __init__(self, verbose=False, dry_run=False, force=False):
6162
"Compiling may fail because of undefined preprocessor macros."
6263
)
6364

64-
self.cc = os.environ.get('CC', 'gcc')
65-
self.cxx = os.environ.get('CXX', 'g++')
65+
self.cc, self.cxx = get_config_vars('CC', 'CXX')
66+
67+
# Override 'CC' and 'CXX' environment variables for
68+
# building using MINGW compiler for MSVC python.
69+
self.cc = os.environ.get('CC', self.cc or 'gcc')
70+
self.cxx = os.environ.get('CXX', self.cxx or 'g++')
6671

6772
self.linker_dll = self.cc
6873
self.linker_dll_cxx = self.cxx

0 commit comments

Comments
 (0)