@@ -238,7 +238,7 @@ def _get_task_type(
238238 sources = f .read ().splitlines ()
239239sources = [source for source in sources if not (source .startswith ("#" ) or source == "" )]
240240
241- TASK_GROUPS = []
241+ task_groups = []
242242for source in sources :
243243 t_start = time .perf_counter ()
244244 print (f"START processing { source = } " )
@@ -274,7 +274,7 @@ def _get_task_type(
274274
275275 TaskGroupReadV2 (** task_group )
276276
277- TASK_GROUPS .append (task_group )
277+ task_groups .append (task_group )
278278
279279 t_end = time .perf_counter ()
280280 print (
@@ -285,8 +285,20 @@ def _get_task_type(
285285 )
286286 print ()
287287
288+ # grouping results
289+ GROUPED_RESULT = []
290+
291+ for task_group in task_groups :
292+ if any (existing_pkg_name == task_group ["pkg_name" ] for existing_pkg_name , _ in GROUPED_RESULT ):
293+ raise ValueError (f"Duplicate package name found: { task_group ['pkg_name' ]} " )
294+
295+ GROUPED_RESULT .append ((task_group ["pkg_name" ], [task_group ]))
296+
297+ # sort by package name
298+ GROUPED_RESULT .sort (key = lambda x : x [0 ].lower ())
299+
288300output_file = Path (__file__ ).parent / "tasks.json"
289301with output_file .open ("w" ) as f :
290- json .dump (TASK_GROUPS , f , indent = 2 )
302+ json .dump (GROUPED_RESULT , f , indent = 2 )
291303
292304DOWNLOAD_FOLDER .rmdir ()
0 commit comments