From 80adfa633a5b71ced97ec72728a9ac6e529c71e8 Mon Sep 17 00:00:00 2001 From: Victor Stinner Date: Fri, 25 Apr 2025 11:50:55 +0200 Subject: [PATCH] gh-132415: Use shutil.which() in missing_compiler_executable() (GH-132906) Replace deprecated distutils.spawn.find_executable() with shutil.which() in missing_compiler_executable() of test.support. (cherry picked from commit de6482eda3a46cc9c9a03fb9ba57295ab99b4722) Co-authored-by: Victor Stinner --- Lib/test/support/__init__.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Lib/test/support/__init__.py b/Lib/test/support/__init__.py index c8993476240de1..eb971abceb010c 100644 --- a/Lib/test/support/__init__.py +++ b/Lib/test/support/__init__.py @@ -1804,8 +1804,9 @@ def missing_compiler_executable(cmd_names=[]): missing. """ - from setuptools._distutils import ccompiler, sysconfig, spawn + from setuptools._distutils import ccompiler, sysconfig from setuptools import errors + import shutil compiler = ccompiler.new_compiler() sysconfig.customize_compiler(compiler) @@ -1824,7 +1825,7 @@ def missing_compiler_executable(cmd_names=[]): "the '%s' executable is not configured" % name elif not cmd: continue - if spawn.find_executable(cmd[0]) is None: + if shutil.which(cmd[0]) is None: return cmd[0]