Skip to content
Snippets Groups Projects
Commit 4dc1fc2b authored by Matt Harbison's avatar Matt Harbison
Browse files

setup: avoid the deprecated `distutils.spawn.find_executable`

I noticed this was flagged with `DeprecationWarning` in py3.12 with `setuptools`
74.1.2, and it suggested `shutil.which()` instead.  The signatures aren't the
same, but the additional `mode` argument in the middle of the latter defaults to
`os.F_OK | os.X_OK`, which maintains the same semantics.
parent 3f0db3b6
No related branches found
No related tags found
3 merge requests!1041Merge default into stable,!997tests: use shlex.quote instead of pipes.quote,!940Followup setup.py modernization
......@@ -125,7 +125,7 @@
from distutils.command.install_lib import install_lib
from distutils.command.install_scripts import install_scripts
from distutils import log
from distutils.spawn import spawn, find_executable
from distutils.spawn import spawn
from distutils import file_util
from distutils.errors import (
CCompilerError,
......@@ -464,6 +464,12 @@
description = "build translations (.mo files)"
def run(self):
try:
from shutil import which as find_executable
except ImportError:
# Deprecated in py3.12
from distutils.spawn import find_executable
if not find_executable('msgfmt'):
self.warn(
"could not find msgfmt executable, no translations "
......
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