Commit 7d0b88f8 authored by Yuki Shiino's avatar Yuki Shiino Committed by Commit Bot

bind-gen: Improve the progress print of the binding generator

Improves the progress print so that the intention will be
a little clearer; when the bindings code generation finishes,
leave the last message on the console.

When https://crrev.com/c/2081633 will land, the bindings code
generation will be very long (a few minutes).  It could make
Chromium developers wonder if a build completely stops.  Hope
that printing the progress would prevent such a concern.

Bug: 839389, 1108111
Change-Id: If556010d2d3469c5e0ded6d9b96fa6a5ffc26764
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2313816Reviewed-by: default avatarHitoshi Yoshida <peria@chromium.org>
Commit-Queue: Yuki Shiino <yukishiino@chromium.org>
Cr-Commit-Position: refs/heads/master@{#791764}
parent fc16d3a8
...@@ -82,18 +82,21 @@ def main(): ...@@ -82,18 +82,21 @@ def main():
dispatch_table[task](task_queue=task_queue, dispatch_table[task](task_queue=task_queue,
web_idl_database=web_idl_database) web_idl_database=web_idl_database)
def report_progress(total, done): def print_to_console(message):
out = sys.stdout out = sys.stdout
if not out.isatty(): if not out.isatty():
return return
if total == 0:
return
percentage = int(float(done) / float(total) * 100)
message = "Blink-V8 bindings generation: {}% done\r".format(percentage)
out.write(message) out.write(message)
out.flush() out.flush()
def report_progress(total, done):
percentage = (int(float(done) / float(total) *
100) if total != 0 else 100)
message = "Blink-V8 bindings generation: {}% done\r".format(percentage)
print_to_console(message)
task_queue.run(report_progress) task_queue.run(report_progress)
print_to_console("\n")
if __name__ == '__main__': if __name__ == '__main__':
......
Markdown is supported
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