aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild/msubprojects.py
diff options
context:
space:
mode:
authorNirbheek Chauhan <nirbheek@centricular.com>2020-01-22 21:04:30 +0530
committerXavier Claessens <xclaesse@gmail.com>2020-01-22 17:29:38 -0500
commit712b2f08c7126863a68dc98c021fc40a4de462fd (patch)
tree35c916bbcb276fd7b4b7e6de2dd429afa02e2c1e /mesonbuild/msubprojects.py
parentda486bfddcc2569dcd92ac26c86d8102824eb001 (diff)
downloadmeson-712b2f08c7126863a68dc98c021fc40a4de462fd.zip
meson-712b2f08c7126863a68dc98c021fc40a4de462fd.tar.gz
meson-712b2f08c7126863a68dc98c021fc40a4de462fd.tar.bz2
Move git helper out into mesonlib for reuse
Reuse the git helper for `meson wrap` and `meson subprojects` so we don't need to maintain the same git-colors-on-windows workarounds in multiple places.
Diffstat (limited to 'mesonbuild/msubprojects.py')
-rwxr-xr-xmesonbuild/msubprojects.py10
1 files changed, 3 insertions, 7 deletions
diff --git a/mesonbuild/msubprojects.py b/mesonbuild/msubprojects.py
index c69684f..d6f0715 100755
--- a/mesonbuild/msubprojects.py
+++ b/mesonbuild/msubprojects.py
@@ -2,7 +2,7 @@ import os, subprocess
import argparse
from . import mlog
-from .mesonlib import Popen_safe
+from .mesonlib import git, Popen_safe
from .wrap.wrap import API_ROOT, PackageDefinition, Resolver, WrapException
from .wrap import wraptool
@@ -40,12 +40,8 @@ def update_file(wrap, repo_dir, options):
' In that case, delete', mlog.bold(repo_dir), 'and run', mlog.bold('meson --reconfigure'))
def git_output(cmd, workingdir):
- return subprocess.check_output(['git', '-C', workingdir] + cmd,
- # Redirect stdin to DEVNULL otherwise git
- # messes up the console and ANSI colors stop
- # working on Windows.
- stdin=subprocess.DEVNULL,
- stderr=subprocess.STDOUT).decode()
+ return git(cmd, workingdir, check=True, universal_newlines=True,
+ stdout=subprocess.PIPE, stderr=subprocess.STDOUT).stdout
def git_show(repo_dir):
commit_message = git_output(['show', '--quiet', '--pretty=format:%h%n%d%n%s%n[%an]'], repo_dir)