Can specify scan-build executable with an environment variable. Closes #1015.

pull/1017/head
Jussi Pakkanen 8 years ago
parent 3a4d56c2d3
commit f7431fd5db
  1. 13
      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)

Loading…
Cancel
Save