aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJussi Pakkanen <jpakkane@gmail.com>2016-11-09 15:46:40 +0200
committerJussi Pakkanen <jpakkane@gmail.com>2016-11-09 10:26:27 -0500
commitf7431fd5dba1f59ce70b07d7074999d1e7442887 (patch)
treef0872da35f2ac4da2378ef20a4b2ad631c901ef7
parent3a4d56c2d3649d8c0919737a306dec5fce30f2c9 (diff)
downloadmeson-f7431fd5dba1f59ce70b07d7074999d1e7442887.zip
meson-f7431fd5dba1f59ce70b07d7074999d1e7442887.tar.gz
meson-f7431fd5dba1f59ce70b07d7074999d1e7442887.tar.bz2
Can specify scan-build executable with an environment variable. Closes #1015.
-rw-r--r--mesonbuild/scripts/scanbuild.py13
1 files changed, 7 insertions, 6 deletions
diff --git a/mesonbuild/scripts/scanbuild.py b/mesonbuild/scripts/scanbuild.py
index f13a1a4..dd74ce8 100644
--- a/mesonbuild/scripts/scanbuild.py
+++ b/mesonbuild/scripts/scanbuild.py
@@ -16,10 +16,10 @@ import subprocess
import shutil
import tempfile
-def scanbuild(srcdir, blddir, privdir, logdir, args):
+def scanbuild(exename, srcdir, blddir, privdir, logdir, args):
with tempfile.TemporaryDirectory(dir=privdir) as scandir:
- meson_cmd = ['scan-build'] + args
- build_cmd = ['scan-build', '-o', logdir, 'ninja']
+ meson_cmd = [exename] + args
+ build_cmd = [exename, '-o', logdir, 'ninja']
rc = subprocess.call(meson_cmd + [srcdir, scandir])
if rc != 0:
return rc
@@ -32,7 +32,8 @@ def run(args):
privdir = os.path.join(blddir, 'meson-private')
logdir = os.path.join(blddir, 'meson-logs/scanbuild')
shutil.rmtree(logdir, ignore_errors=True)
- if not shutil.which('scan-build'):
- print('Scan-build not installed')
+ exename = os.environ.get('SCANBUILD', 'scan-build')
+ if not shutil.which(exename):
+ print('Scan-build not installed.')
return 1
- return scanbuild(srcdir, blddir, privdir, logdir, meson_cmd)
+ return scanbuild(exename, srcdir, blddir, privdir, logdir, meson_cmd)