Add sku list script

Generate a list of each skuid for a specific UCM config of a variant of
a board. Code is messy but it gets the job done.
pull/4/head
WeirdTreeThing 2023-08-22 21:27:29 -04:00
parent 9b92bd98a8
commit ae18d8c46d
No known key found for this signature in database
GPG Key ID: 1F56A4B52998B851
1 changed files with 30 additions and 0 deletions

30
generate-sku-list.py Executable file
View File

@ -0,0 +1,30 @@
#!/usr/bin/env python3
import os
import sys
import json
variant = ""
ucm_suffixes = []
sku_ids = {}
with open("project-config.json", "r") as project:
p_json = json.load(project)
configs = p_json['chromeos']['configs']
for config in configs:
if config['audio']['main']['cras-config-dir'] == variant:
if not config['audio']['main']['ucm-suffix'] in ucm_suffixes:
ucm_suffixes.append(config['audio']['main']['ucm-suffix'])
sku_ids[config['audio']['main']['ucm-suffix']] = []
sku_ids[config['audio']['main']['ucm-suffix']].append(config['identity']['sku-id'])
for suffix in sku_ids:
suffixes_formatted = ""
for sku in sku_ids[suffix]:
if suffixes_formatted == "":
suffixes_formatted = str(sku)
else:
suffixes_formatted = f"{suffixes_formatted}|{str(sku)}"
print(f"{suffix}: {suffixes_formatted}")