summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Lib/test/support/__init__.py8
1 files changed, 7 insertions, 1 deletions
diff --git a/Lib/test/support/__init__.py b/Lib/test/support/__init__.py
index f8f60fb..b21978a 100644
--- a/Lib/test/support/__init__.py
+++ b/Lib/test/support/__init__.py
@@ -1673,9 +1673,15 @@ def missing_compiler_executable(cmd_names=[]):
missing.
"""
- from distutils import ccompiler, sysconfig, spawn
+ from distutils import ccompiler, sysconfig, spawn, errors
compiler = ccompiler.new_compiler()
sysconfig.customize_compiler(compiler)
+ if compiler.compiler_type == "msvc":
+ # MSVC has no executables, so check whether initialization succeeds
+ try:
+ compiler.initialize()
+ except errors.DistutilsPlatformError:
+ return "msvc"
for name in compiler.executables:
if cmd_names and name not in cmd_names:
continue