tool/update_btstack_config: support adding more than one define

This commit is contained in:
Matthias Ringwald 2022-04-04 12:41:41 +02:00
parent 481c0cbc48
commit a9d074b9db

View File

@ -33,15 +33,19 @@ def configuration_from_block(block, line_ending):
if item in block:
block.remove(item)
defines_processed = []
for item in temp_defines_to_add:
if item in block:
temp_defines_to_add.remove(item)
defines_processed.append(item)
continue
if len(block) > 0:
prefix = block[0].split("_")[0]
if item.startswith(prefix):
block.append(item)
defines_processed.append(item)
for item in defines_processed:
temp_defines_to_add.remove(item)
block.sort()
@ -84,7 +88,8 @@ def read_and_update_configuration(full_path, line_ending):
configuration += ("%s%s" % (line, line_ending))
if len(temp_defines_to_add) > 0:
print("Cannot add defines: " % temp_defines_to_add)
print("Cannot add defines: \n- " + "\n- ".join(temp_defines_to_add))
print("ABORT")
sys.exit(10)
# if end of file could not be detected, process last block