From: Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> Date: Wed, 11 Jun 2025 15:00:01 +0000 (+0200) Subject: [3.12] gh-132415: Use shutil.which() in missing_compiler_executable() (GH-132906... X-Git-Tag: v3.12.12~25 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=d43cb4f31a95ee511d86e8adbfa1bea9747d75d3;p=thirdparty%2FPython%2Fcpython.git [3.12] gh-132415: Use shutil.which() in missing_compiler_executable() (GH-132906) (GH-135392) 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 --- diff --git a/Lib/test/support/__init__.py b/Lib/test/support/__init__.py index c8993476240d..eb971abceb01 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]