summaryrefslogtreecommitdiff
path: root/mesonbuild/scripts
diff options
context:
space:
mode:
authorMads Andreasen <github@andreasen.cc>2024-04-07 16:12:50 +0200
committerJussi Pakkanen <jpakkane@gmail.com>2024-07-10 21:47:46 +0300
commit50704bced3775e9bc5b34f4295e282bfac7253f0 (patch)
tree01a0c0294f1f58e4efffee0c7e5abad35c638c6e /mesonbuild/scripts
parentf01ae52bc224e46661e0ee4404c949e4e27773a8 (diff)
downloadmeson-50704bced3775e9bc5b34f4295e282bfac7253f0.tar.gz
Replace exe_exists function with shutil.which()
The documentation for subprocess.run at https://docs.python.org/3/library/subprocess.html#popen-constructor has a warning, pointing to using shutil.which() instead of subprocess.run for detecting if exe files exists on the path. shutil.which() is used in many places already.
Diffstat (limited to 'mesonbuild/scripts')
-rw-r--r--mesonbuild/scripts/coverage.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/mesonbuild/scripts/coverage.py b/mesonbuild/scripts/coverage.py
index 17a4a10ae..f01946944 100644
--- a/mesonbuild/scripts/coverage.py
+++ b/mesonbuild/scripts/coverage.py
@@ -5,7 +5,7 @@ from __future__ import annotations
from mesonbuild import environment, mesonlib
-import argparse, re, sys, os, subprocess, pathlib, stat
+import argparse, re, sys, os, subprocess, pathlib, stat, shutil
import typing as T
def coverage(outputs: T.List[str], source_root: str, subproject_root: str, build_root: str, log_dir: str, use_llvm_cov: bool,
@@ -17,7 +17,7 @@ def coverage(outputs: T.List[str], source_root: str, subproject_root: str, build
gcovr_exe = None
else:
gcovr_exe, gcovr_version = environment.detect_gcovr(gcovr_exe)
- if llvm_cov_exe == '' or not mesonlib.exe_exists([llvm_cov_exe, '--version']):
+ if llvm_cov_exe == '' or shutil.which(llvm_cov_exe) is None:
llvm_cov_exe = None
lcov_exe, lcov_version, genhtml_exe = environment.detect_lcov_genhtml()