From bb3b9c008ba5198a3a0b186ccf7488bfdfc63839 Mon Sep 17 00:00:00 2001 From: "Salvador E. Tropea" Date: Wed, 27 Jan 2021 11:48:19 -0300 Subject: [PATCH] Sorted the `Source BoM` column --- kibot/bom/bom.py | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/kibot/bom/bom.py b/kibot/bom/bom.py index 09faafa8..572fef7d 100644 --- a/kibot/bom/bom.py +++ b/kibot/bom/bom.py @@ -186,16 +186,18 @@ class ComponentGroup(object): def get_sources(self): sources = {} for c in self.components: - if c.project in sources: - sources[c.project] += 1 - else: - sources[c.project] = 1 - field = '' - for prj, n in sources.items(): - if len(field): - field += ' ' + prj = c.project if self.cfg.source_by_id: prj = self.cfg.source_to_id[prj] + if prj in sources: + sources[prj] += 1 + else: + sources[prj] = 1 + field = '' + for prj in sorted(sources.keys()): + n = sources[prj] + if len(field): + field += ' ' field += prj+'('+str(n)+')' return field