aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild
diff options
context:
space:
mode:
authorJussi Pakkanen <jpakkane@gmail.com>2021-06-02 17:13:04 +0300
committerJussi Pakkanen <jpakkane@gmail.com>2021-06-02 21:23:51 +0300
commit83581f7fc1b27037bf993772ad495d436816f2c2 (patch)
treec5897e1529e9e523e3c41602e65e42f1c004b060 /mesonbuild
parent4516b7a8a93bb1e6d4683359aafedb3917d9e998 (diff)
downloadmeson-83581f7fc1b27037bf993772ad495d436816f2c2.zip
meson-83581f7fc1b27037bf993772ad495d436816f2c2.tar.gz
meson-83581f7fc1b27037bf993772ad495d436816f2c2.tar.bz2
Do not delete workdir in case scan-build fails.
Diffstat (limited to 'mesonbuild')
-rw-r--r--mesonbuild/scripts/scanbuild.py21
1 files changed, 13 insertions, 8 deletions
diff --git a/mesonbuild/scripts/scanbuild.py b/mesonbuild/scripts/scanbuild.py
index 0736b3f..bb8e30c 100644
--- a/mesonbuild/scripts/scanbuild.py
+++ b/mesonbuild/scripts/scanbuild.py
@@ -17,20 +17,25 @@ import shutil
import tempfile
from ..environment import detect_ninja, detect_scanbuild
from ..coredata import get_cmd_line_file, CmdLineFileParser
+from ..mesonlib import windows_proof_rmtree
from pathlib import Path
import typing as T
from ast import literal_eval
import os
def scanbuild(exelist: T.List[str], srcdir: Path, blddir: Path, privdir: Path, logdir: Path, args: T.List[str]) -> int:
- with tempfile.TemporaryDirectory(dir=str(privdir)) as scandir:
- meson_cmd = exelist + args
- build_cmd = exelist + ['-o', str(logdir)] + detect_ninja() + ['-C', scandir]
- rc = subprocess.call(meson_cmd + [str(srcdir), scandir])
- if rc != 0:
- return rc
- return subprocess.call(build_cmd)
-
+ # In case of problems leave the temp directory around
+ # so it can be debugged.
+ scandir = tempfile.mkdtemp(dir=str(privdir))
+ meson_cmd = exelist + args
+ build_cmd = exelist + ['-o', str(logdir)] + detect_ninja() + ['-C', scandir]
+ rc = subprocess.call(meson_cmd + [str(srcdir), scandir])
+ if rc != 0:
+ return rc
+ rc = subprocess.call(build_cmd)
+ if rc == 0:
+ windows_proof_rmtree(scandir)
+ return rc
def run(args: T.List[str]) -> int:
srcdir = Path(args[0])