From: Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> Date: Thu, 9 Jul 2020 18:12:07 +0000 (-0700) Subject: bpo-41172: Fix check for compiler in test suite (GH-21400) X-Git-Tag: v3.9.0b5~28 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=c65ee555124a5647b8e3a5d58c906fa5db9e927a;p=thirdparty%2FPython%2Fcpython.git bpo-41172: Fix check for compiler in test suite (GH-21400) (cherry picked from commit af56c4fc76ac39ce76d649d7bebf7f78c1add4fa) Co-authored-by: Steve Dower --- diff --git a/Lib/test/support/__init__.py b/Lib/test/support/__init__.py index 19d52fdfe071..aee3737ffc40 100644 --- a/Lib/test/support/__init__.py +++ b/Lib/test/support/__init__.py @@ -2733,9 +2733,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