summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2024-07-17 16:57:07 +0100
committerSimon Glass <sjg@chromium.org>2024-07-26 08:01:06 -0600
commit0229eeef7b821fe74cbfdc1bd6627cf6d2984319 (patch)
treeb1318f33e1ab4fd5ee23ff244c81c97faf20cbe5 /tools
parent6c2a4385ff413339eaebdf57046b6eb57e6b6bc6 (diff)
downloadu-boot-0229eeef7b821fe74cbfdc1bd6627cf6d2984319.tar.gz
u-boot-0229eeef7b821fe74cbfdc1bd6627cf6d2984319.tar.bz2
u-boot-0229eeef7b821fe74cbfdc1bd6627cf6d2984319.zip
qconfig: Move progress output into the class
Rather than create these outputs separately, put them in the class so that the main program doesn't need to deal with them. Signed-off-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'tools')
-rwxr-xr-xtools/qconfig.py28
1 files changed, 19 insertions, 9 deletions
diff --git a/tools/qconfig.py b/tools/qconfig.py
index dc5b769106..405981938e 100755
--- a/tools/qconfig.py
+++ b/tools/qconfig.py
@@ -217,20 +217,26 @@ def read_file(fname, as_lines=True, skip_unicode=False):
### classes ###
class Progress:
-
"""Progress Indicator"""
def __init__(self, col, total):
"""Create a new progress indicator.
Args:
- color_enabled (bool): True for colour output
+ col (terminal.Color): Colour-output class
total (int): A number of defconfig files to process.
+
+ current (int): Number of boards processed so far
+ failed (int): Number of failed boards
+ failure_msg (str): Message indicating number of failures, '' if none
"""
self.col = col
+ self.total = total
+
self.current = 0
self.good = 0
- self.total = total
+ self.failed = None
+ self.failure_msg = None
def inc(self, success):
"""Increment the number of processed defconfig files.
@@ -252,6 +258,11 @@ class Progress:
print(f'{line} \r', end='')
sys.stdout.flush()
+ def completed(self):
+ """Set up extra properties when completed"""
+ self.failed = self.total - self.good
+ self.failure_msg = f'{self.failed} failed, ' if self.failed else ''
+
def scan_kconfig():
"""Scan all the Kconfig files and create a Config object
@@ -752,6 +763,7 @@ def move_config(args, col):
slots.write_failed_boards()
db_queue.join()
+ progress.completed()
return config_db, progress
def find_kconfig_rules(kconf, config, imply_config):
@@ -1634,8 +1646,6 @@ def main():
if args.commit:
add_commit(args.configs)
- failed = progress.total - progress.good
- failure = f'{failed} failed, ' if failed else ''
if args.build_db:
configs = args.configs
with open(CONFIG_DATABASE, 'w', encoding='utf-8') as outf:
@@ -1645,11 +1655,11 @@ def main():
outf.write(f' {config}={configs[config]}\n')
outf.write('\n')
print(col.build(
- col.RED if failed else col.GREEN,
- f'{failure}{len(config_db)} boards written to {CONFIG_DATABASE}'))
+ col.RED if progress.failed else col.GREEN,
+ f'{progress.failure_msg}{len(config_db)} boards written to {CONFIG_DATABASE}'))
else:
- if failed:
- print(col.build(col.RED, f'{failure}see {FAILED_LIST}', True))
+ if progress.failed:
+ print(col.build(col.RED, f'{progress.failure_msg}see {FAILED_LIST}', True))
else:
# Add enough spaces to overwrite the progress indicator
print(col.build(