diff options
| author | Mads Andreasen <github@andreasen.cc> | 2024-04-07 16:12:50 +0200 |
|---|---|---|
| committer | Jussi Pakkanen <jpakkane@gmail.com> | 2024-07-10 21:47:46 +0300 |
| commit | 50704bced3775e9bc5b34f4295e282bfac7253f0 (patch) | |
| tree | 01a0c0294f1f58e4efffee0c7e5abad35c638c6e /mesonbuild/scripts/coverage.py | |
| parent | f01ae52bc224e46661e0ee4404c949e4e27773a8 (diff) | |
| download | meson-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/coverage.py')
| -rw-r--r-- | mesonbuild/scripts/coverage.py | 4 |
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() |
