Skip to content
Snippets Groups Projects
Unverified Commit 11ad487f authored by Robin De Schepper's avatar Robin De Schepper Committed by GitHub
Browse files

Write build-catalogue (c)make errors to `stdout` and `stderr` (#1679)

parent e03a8ce2
No related branches found
No related tags found
No related merge requests found
......@@ -145,9 +145,32 @@ with TemporaryDirectory() as tmp:
if verbose:
out, err = (None, None)
else:
out, err = (sp.DEVNULL, sp.DEVNULL)
sp.run('cmake ..', shell=True, check=True, stdout=out, stderr=err)
sp.run('make', shell=True, check=True, stdout=out, stderr=err)
shutil.copy2(f'{name}-catalogue.so', pwd)
out, err = (sp.PIPE, sp.PIPE)
try:
sp.run('cmake ..', shell=True, check=True, stdout=out, stderr=err)
sp.run('make', shell=True, check=True, stdout=out, stderr=err)
shutil.copy2(f'{name}-catalogue.so', pwd)
except sp.CalledProcessError as e:
import sys, traceback as tb
if not verbose:
# Not in verbose mode, so we have captured the
# `stdout` and `stderr` and can print it to the user.
sys.stdout.write("Build log:\n")
sys.stdout.write(e.stdout.decode())
sys.stderr.write(tb.format_exc() + " Error:\n\n")
sys.stderr.write(e.stderr.decode())
else:
# In verbose mode the outputs weren't captured and
# have been streamed to `stdout` and `stderr` already.
sys.stderr.write(
"Catalogue building error occurred."
+ " Check stdout log for underlying error,"
+ " or omit verbose flag to capture it."
)
sys.stdout.flush()
sys.stderr.flush()
exit(e.returncode)
if not quiet:
print(f'Catalogue has been built and copied to {pwd}/{name}-catalogue.so')
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment