scripts/liberty: Support new comma only syntax.

Syntax before;
```
comp_attribute blah,blah
```

Syntax after;
```
comp_attribute,blah,blah
```

Signed-off-by: Tim 'mithro' Ansell <me@mith.ro>
This commit is contained in:
Tim 'mithro' Ansell 2020-07-20 16:15:55 -07:00
parent e14136b064
commit d7a58ea703
1 changed files with 4 additions and 3 deletions

View File

@ -965,8 +965,9 @@ def liberty_dict(dtype, dvalue, data, indent=tuple(), attribute_types=None):
# Sort the attributes # Sort the attributes
def attr_sort_key(item): def attr_sort_key(item):
k, v = item k, v = item
if " " in k:
ktype, kvalue = k.split(" ", 1) if "," in k:
ktype, kvalue = k.split(",", 1)
sortable_kv = sortable_extracted_numbers(kvalue) sortable_kv = sortable_extracted_numbers(kvalue)
else: else:
ktype = k ktype = k
@ -1042,7 +1043,7 @@ def liberty_dict(dtype, dvalue, data, indent=tuple(), attribute_types=None):
o.append('%s%s : "%s";' % (INDENT*len(indent_n), k, l)) o.append('%s%s : "%s";' % (INDENT*len(indent_n), k, l))
else: else:
raise ValueError("Unknown %s: %r\n%s" % (k, v, indent_n)) raise ValueError("Unknown %s: %r\n%s" % ((ktype, kvalue, k), v, indent_n))
else: else:
if ktype in dtype_attribute_types: if ktype in dtype_attribute_types: