diff options
author | Nirbheek Chauhan <nirbheek@centricular.com> | 2020-01-22 21:04:30 +0530 |
---|---|---|
committer | Xavier Claessens <xclaesse@gmail.com> | 2020-01-22 17:29:38 -0500 |
commit | 712b2f08c7126863a68dc98c021fc40a4de462fd (patch) | |
tree | 35c916bbcb276fd7b4b7e6de2dd429afa02e2c1e /mesonbuild/wrap/wrap.py | |
parent | da486bfddcc2569dcd92ac26c86d8102824eb001 (diff) | |
download | meson-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/wrap/wrap.py')
-rw-r--r-- | mesonbuild/wrap/wrap.py | 16 |
1 files changed, 1 insertions, 15 deletions
diff --git a/mesonbuild/wrap/wrap.py b/mesonbuild/wrap/wrap.py index 92e37de..e9b47a0 100644 --- a/mesonbuild/wrap/wrap.py +++ b/mesonbuild/wrap/wrap.py @@ -18,7 +18,6 @@ import urllib.request import urllib.error import urllib.parse import os -import platform import hashlib import shutil import tempfile @@ -29,7 +28,7 @@ import configparser import typing as T from . import WrapMode -from ..mesonlib import ProgressBar, MesonException +from ..mesonlib import git, GIT, ProgressBar, MesonException if T.TYPE_CHECKING: import http.client @@ -44,23 +43,10 @@ except ImportError: has_ssl = False API_ROOT = 'http://wrapdb.mesonbuild.com/v1/' -GIT = shutil.which('git') REQ_TIMEOUT = 600.0 SSL_WARNING_PRINTED = False WHITELIST_SUBDOMAIN = 'wrapdb.mesonbuild.com' -def git(cmd: T.List[str], workingdir: str, **kwargs) -> subprocess.CompletedProcess: - pc = subprocess.run([GIT, '-C', workingdir] + cmd, - # Redirect stdin to DEVNULL otherwise git messes up the - # console and ANSI colors stop working on Windows. - stdin=subprocess.DEVNULL, **kwargs) - # Sometimes git calls git recursively, such as `git submodule update - # --recursive` which will be without the above workaround, so set the - # console mode again just in case. - if platform.system().lower() == 'windows': - mlog._windows_ansi() - return pc - def quiet_git(cmd: T.List[str], workingdir: str) -> T.Tuple[bool, str]: if not GIT: return False, 'Git program not found.' |