Skip to content

Commit 7283751

Browse files
authored
cygwinccompiler: Get the compilers from sysconfig
Merge pull request pypa/distutils#296 from msys2-contrib/clang-compilers
2 parents 47353c5 + 4ecf617 commit 7283751

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)