aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild/scripts/scanbuild.py
diff options
context:
space:
mode:
authorsnsmac <jr98@hotmail.de>2017-12-25 15:49:30 +0100
committerJussi Pakkanen <jpakkane@gmail.com>2017-12-30 23:22:39 +0200
commit27d5c1c3f91ec320f5d0de23bc9729737d3dca52 (patch)
treeb4707d5871603597f0219ceb370b2387ee9244d3 /mesonbuild/scripts/scanbuild.py
parenta9c57e17a9389eb057e2857eb21c430d67d43e09 (diff)
downloadmeson-27d5c1c3f91ec320f5d0de23bc9729737d3dca52.zip
meson-27d5c1c3f91ec320f5d0de23bc9729737d3dca52.tar.gz
meson-27d5c1c3f91ec320f5d0de23bc9729737d3dca52.tar.bz2
The scanbuild script does now also look for executables with a version in the name
Diffstat (limited to 'mesonbuild/scripts/scanbuild.py')
-rw-r--r--mesonbuild/scripts/scanbuild.py26
1 files changed, 25 insertions, 1 deletions
diff --git a/mesonbuild/scripts/scanbuild.py b/mesonbuild/scripts/scanbuild.py
index 728214f..f381552 100644
--- a/mesonbuild/scripts/scanbuild.py
+++ b/mesonbuild/scripts/scanbuild.py
@@ -17,6 +17,7 @@ import subprocess
import shutil
import tempfile
from ..environment import detect_ninja
+from ..mesonlib import Popen_safe
def scanbuild(exename, srcdir, blddir, privdir, logdir, args):
with tempfile.TemporaryDirectory(dir=privdir) as scandir:
@@ -34,7 +35,30 @@ def run(args):
privdir = os.path.join(blddir, 'meson-private')
logdir = os.path.join(blddir, 'meson-logs/scanbuild')
shutil.rmtree(logdir, ignore_errors=True)
- exename = os.environ.get('SCANBUILD', 'scan-build')
+ tools = [
+ 'scan-build', # base
+ 'scan-build-5.0', 'scan-build50', # latest stable release
+ 'scan-build-4.0', 'scan-build40', # old stable releases
+ 'scan-build-3.9', 'scan-build39',
+ 'scan-build-3.8', 'scan-build38',
+ 'scan-build-3.7', 'scan-build37',
+ 'scan-build-3.6', 'scan-build36',
+ 'scan-build-3.5', 'scan-build35',
+ 'scan-build-6.0', 'scan-build-devel', # development snapshot
+ ]
+ toolname = 'scan-build'
+ for tool in tools:
+ try:
+ p, out = Popen_safe([tool, '--help'])[:2]
+ except (FileNotFoundError, PermissionError):
+ continue
+ if p.returncode != 0:
+ continue
+ else:
+ toolname = tool
+ break
+
+ exename = os.environ.get('SCANBUILD', toolname)
if not shutil.which(exename):
print('Scan-build not installed.')
return 1