manifest: minor bugfixes and improvements
- More robust string handling by using Unicode
- Unix line ending in generated files
- Don't call keyword_substitute if
- no keychains in line
- printing to output is disabled due to unmet condition
- Fix handling of list of leaf datatypes in db
Change-Id: Ic9c9bdba12b2f536ffa707342728b1277363e99f
Signed-off-by: Miklos Balint <miklos.balint@arm.com>
diff --git a/tools/keyword_substitution.py b/tools/keyword_substitution.py
index 9a98aae..1687338 100644
--- a/tools/keyword_substitution.py
+++ b/tools/keyword_substitution.py
@@ -24,6 +24,7 @@
REkeychain = "@@\w+[\.\w+]*@@"
REfirstkeyword = "@@\w+\.?"
+emptychain = "@@@@"
MISSING_KEYS_ACTION = 'halt'
@@ -43,7 +44,7 @@
depth += 1
log_print(Verbosity.info, "substitute(",templist, chains, db, depth,")")
if isinstance(db, type([])):
- # db node is list
+ # db is list
outlist = []
for instance in db:
log_print(Verbosity.info, "Going deeper at", depth, "for db list instance", instance)
@@ -51,8 +52,21 @@
log_print(Verbosity.info, "substitute", depth, "returning from list with", outlist)
return outlist
- # db node is dict/leaf
transientlist = list(templist)
+ if leaftype(db):
+ # db is leaf
+ for chain in chains:
+ if templist[chain] == emptychain:
+ transientlist[chain] = str(db)
+ else:
+ print "keychain not empty but db is"
+ transientlist[chain] = str(db) + templist[chain]
+ continue
+ chains = []
+ log_print(Verbosity.info, "substitute", depth, "returning from leaf with", transientlist)
+ return transientlist
+
+ # db is dict
# find chain groups with same key
chaingroups = {"chains": [], "keys": []}
for chain in chains:
@@ -78,7 +92,7 @@
log_print(Verbosity.info, "key lookup in", db, "for", key)
if key in db.keys():
if leaftype(db[key]):
- # db node is leaf
+ # db entry value is leaf
for chain in chaingroups["chains"][groupidx]:
transientlist[chain] = str(db[key])
chaingroups["chains"][groupidx] = []