external_project: Write output in log files when not verbose

pull/7848/merge
Xavier Claessens 4 years ago committed by Jussi Pakkanen
parent ea2f34e286
commit 903c8716e3
  1. 9
      mesonbuild/modules/unstable_external_project.py

@ -162,12 +162,17 @@ class ExternalProject(InterpreterObject):
def _run(self, step: str, command: T.List[str]):
mlog.log('External project {}:'.format(self.name), mlog.bold(step))
output = None if self.verbose else subprocess.DEVNULL
log_filename = Path(mlog.log_dir, '{}-{}.log'.format(self.name, step))
output = None
if not self.verbose:
output = open(log_filename, 'w')
p, o, e = Popen_safe(command, cwd=str(self.build_dir), env=self.run_env,
stderr=subprocess.STDOUT,
stdout=output)
if p.returncode != 0:
m = '{} step failed:\n{}'.format(step, e)
m = '{} step returned error code {}.'.format(step, p.returncode)
if not self.verbose:
m += '\nSee logs: ' + str(log_filename)
raise MesonException(m)
def _create_targets(self):

Loading…
Cancel
Save