Skip to content
Snippets Groups Projects
Commit fef2375b authored by Zbigniew Jędrzejewski-Szmek's avatar Zbigniew Jędrzejewski-Szmek Committed by Chris Lamb
Browse files

Stop using deprecated distutils.spawn.find_executable

distutils is deprecated and slated for removal. Every import of the
module raises a warning with python3.10.

PEP 632 says to use shutil.which instead.
parent fce00cf6
No related branches found
No related tags found
1 merge request!87Stop using deprecated distutils
......@@ -19,20 +19,18 @@
import collections
import functools
import platform
import shutil
try:
import distro
except ImportError:
distro = None
from distutils.spawn import find_executable
from .profiling import profile
from .external_tools import EXTERNAL_TOOLS, REMAPPED_TOOL_NAMES, GNU_TOOL_NAMES
# Memoize calls to ``distutils.spawn.find_executable`` to avoid excessive stat
# calls
find_executable = functools.lru_cache()(find_executable)
# Memoize calls to ``which`` to avoid excessive stat calls
find_executable = functools.lru_cache()(shutil.which)
# The output of --help and --list-tools will use the order of this dict.
# Please keep it alphabetized.
......
......@@ -24,10 +24,9 @@ import functools
import importlib.util
import subprocess
from distutils.spawn import find_executable
from distutils.version import LooseVersion
from diffoscope.tools import get_package_provider
from diffoscope.tools import get_package_provider, find_executable
def file_version():
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment