Skip to content

Commit cbc149a

Browse files
committed
prefix log output for Python C API build so it is easier to see in a parallel build
1 parent cb7bd47 commit cbc149a

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

mx.graalpython/mx_graalpython.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1154,6 +1154,15 @@ def python_build_watch(args):
11541154

11551155

11561156
class GraalpythonCAPIBuildTask(mx.ProjectBuildTask):
1157+
class PrefixingOutput():
1158+
def __init__(self, prefix, printfunc):
1159+
self.prefix = "[" + prefix + "] "
1160+
self.printfunc = printfunc
1161+
1162+
def __call__(self, line):
1163+
# n.b.: mx already sends us the output line-by-line
1164+
self.printfunc(self.prefix + line.rstrip())
1165+
11571166
def __init__(self, args, project):
11581167
jobs = min(mx.cpu_count(), 8)
11591168
super(GraalpythonCAPIBuildTask, self).__init__(args, jobs, project)
@@ -1162,7 +1171,7 @@ def __str__(self):
11621171
return 'Building C API project {} with setuptools'.format(self.subject.name)
11631172

11641173
def run(self, args, env=None, cwd=None):
1165-
return do_run_python(args, env=env, cwd=cwd)
1174+
return do_run_python(args, env=env, cwd=cwd, out=self.PrefixingOutput(self.subject.name, mx.log), err=self.PrefixingOutput(self.subject.name, mx.log_error))
11661175

11671176
def _dev_headers_dir(self):
11681177
return os.path.join(SUITE.dir, "graalpython", "include")

0 commit comments

Comments
 (0)