]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
[3.13] gh-132415: Use shutil.which() in missing_compiler_executable() (GH-132906...
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Fri, 25 Apr 2025 10:41:40 +0000 (12:41 +0200)
committerGitHub <noreply@github.com>
Fri, 25 Apr 2025 10:41:40 +0000 (10:41 +0000)
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 <vstinner@python.org>
Lib/test/support/__init__.py

index 78cf4b3ca8a78834122d296f1842668c8fc879fd..a21b1e70d7016471ffcc400123b53d5942874917 100644 (file)
@@ -1893,8 +1893,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)
@@ -1913,7 +1914,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]