]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
gh-132415: Use shutil.which() in missing_compiler_executable() (#132906)
authorVictor Stinner <vstinner@python.org>
Fri, 25 Apr 2025 09:50:55 +0000 (11:50 +0200)
committerGitHub <noreply@github.com>
Fri, 25 Apr 2025 09:50:55 +0000 (11:50 +0200)
Replace deprecated distutils.spawn.find_executable() with
shutil.which() in missing_compiler_executable() of test.support.

Lib/test/support/__init__.py

index 71820a20d50e6c5caf40aa733576fa8ff6f4e9e9..146cbaaf4cb8546685e0b935bbcd58f5b9c8c246 100644 (file)
@@ -1940,8 +1940,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)
@@ -1960,7 +1961,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]