diff options
author | Daniel Mensinger <daniel@mensinger-ka.de> | 2019-11-19 12:36:05 +0100 |
---|---|---|
committer | Daniel Mensinger <daniel@mensinger-ka.de> | 2019-11-19 15:21:13 +0100 |
commit | 9435f11b17ac428c80ac8af80724aced6c02133a (patch) | |
tree | 2adaa02d0b287834b5d7666560a23572cc4c4743 /mesonbuild/mlog.py | |
parent | b4af3328a4213d92edca4fa74b04d1bd5800962b (diff) | |
download | meson-9435f11b17ac428c80ac8af80724aced6c02133a.zip meson-9435f11b17ac428c80ac8af80724aced6c02133a.tar.gz meson-9435f11b17ac428c80ac8af80724aced6c02133a.tar.bz2 |
ci: Add CI command to include text files in the CI log
Diffstat (limited to 'mesonbuild/mlog.py')
-rw-r--r-- | mesonbuild/mlog.py | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/mesonbuild/mlog.py b/mesonbuild/mlog.py index 14ad92f..ace47f4 100644 --- a/mesonbuild/mlog.py +++ b/mesonbuild/mlog.py @@ -56,6 +56,7 @@ log_timestamp_start = None # type: Optional[float] log_fatal_warnings = False # type: bool log_disable_stdout = False # type: bool log_errors_only = False # type: bool +_in_ci = 'CI' in os.environ # type: bool def disable() -> None: global log_disable_stdout @@ -186,6 +187,15 @@ def debug(*args: Union[str, AnsiDecorator], **kwargs: Any) -> None: print(*arr, file=log_file, **kwargs) log_file.flush() +def _debug_log_cmd(cmd: str, args: List[str]) -> None: + if not _in_ci: + return + args = ['"{}"'.format(x) for x in args] # Quote all args, just in case + debug('!meson_ci!/{} {}'.format(cmd, ' '.join(args))) + +def cmd_ci_include(file: str) -> None: + _debug_log_cmd('ci_include', [file]) + def log(*args: Union[str, AnsiDecorator], is_error: bool = False, **kwargs: Any) -> None: global log_errors_only |