Update sku list script

Refactor some of the code and add an interactive variant chooser
pull/4/head
WeirdTreeThing 2023-08-23 10:47:47 -04:00
parent 96ea3f71fe
commit 96d590c3eb
No known key found for this signature in database
GPG Key ID: 1F56A4B52998B851
1 changed files with 11 additions and 4 deletions

View File

@ -4,8 +4,7 @@ import os
import sys import sys
import json import json
variant = "" variants = []
ucm_suffixes = []
sku_ids = {} sku_ids = {}
with open("project-config.json", "r") as project: with open("project-config.json", "r") as project:
@ -13,10 +12,18 @@ with open("project-config.json", "r") as project:
configs = p_json['chromeos']['configs'] configs = p_json['chromeos']['configs']
print("Variants:")
for config in configs:
variant = config['name']
if not variant in variants:
variants.append(variant)
print(variant)
variant = input("Choose a variant: ")
for config in configs: for config in configs:
if config['audio']['main']['cras-config-dir'] == variant: if config['audio']['main']['cras-config-dir'] == variant:
if not config['audio']['main']['ucm-suffix'] in ucm_suffixes: if not config['audio']['main']['ucm-suffix'] in sku_ids:
ucm_suffixes.append(config['audio']['main']['ucm-suffix'])
sku_ids[config['audio']['main']['ucm-suffix']] = [] sku_ids[config['audio']['main']['ucm-suffix']] = []
sku_ids[config['audio']['main']['ucm-suffix']].append(config['identity']['sku-id']) sku_ids[config['audio']['main']['ucm-suffix']].append(config['identity']['sku-id'])