Fix run_tool() when git is not installed

Previously, it would raise an exception.
pull/11567/head
Alyssa Ross 2 years ago committed by Xavier Claessens
parent 3e7c08f358
commit b85ffbacb1
  1. 6
      mesonbuild/scripts/run_tool.py

@ -19,7 +19,7 @@ from pathlib import Path
from concurrent.futures import ThreadPoolExecutor
from ..compilers import lang_suffixes
from ..mesonlib import Popen_safe
from ..mesonlib import quiet_git
import typing as T
if T.TYPE_CHECKING:
@ -43,8 +43,8 @@ def run_tool(name: str, srcdir: Path, builddir: Path, fn: T.Callable[..., subpro
if patterns:
globs = [srcdir.glob(p) for p in patterns]
else:
p, o, _ = Popen_safe(['git', 'ls-files'], cwd=srcdir)
if p.returncode == 0:
r, o = quiet_git(['ls-files'], srcdir)
if r:
globs = [[Path(srcdir, f) for f in o.splitlines()]]
else:
globs = [srcdir.glob('**/*')]

Loading…
Cancel
Save