From 21486b5979d3895c39b5af4ac24200cb80d5463c Mon Sep 17 00:00:00 2001 From: Hexalotl <15166449+Hexalotl@users.noreply.github.com> Date: Wed, 28 Feb 2024 11:15:41 -0800 Subject: [PATCH] Adding tu name comment in a 3.8 friendly way --- tools/tu_config.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/tools/tu_config.py b/tools/tu_config.py index 71f2c1b4..52cf00d4 100644 --- a/tools/tu_config.py +++ b/tools/tu_config.py @@ -231,6 +231,7 @@ def update_asset_slice_config(tu_name: str, binary_slice_file_path: str, asset_s binary_commented_map = data[binary_commented_map_key] + insert_tu_name_comment = True for section in symbols_for_tu[".data"].sections: for asset_symbol in section.symbols: print("Add entry for: " + asset_symbol.symbol_name + "? (y/n)") @@ -244,10 +245,14 @@ def update_asset_slice_config(tu_name: str, binary_slice_file_path: str, asset_s asset_commented_map : CommentedMap = None if binary_commented_map.__contains__(asset_symbol.symbol_name): asset_commented_map = binary_commented_map[asset_symbol.symbol_name] + insert_tu_name_comment = False else: asset_commented_map = CommentedMap() binary_commented_map.insert(len(binary_commented_map), asset_symbol.symbol_name, asset_commented_map) - binary_commented_map.ca.items[asset_symbol.symbol_name] = [None, asset_symbol.symbol_name, None, None] + + if insert_tu_name_comment: + insert_tu_name_comment = False + binary_commented_map.yaml_set_comment_before_after_key(key=asset_symbol.symbol_name, indent=2, before=tu_name) # Add in the address range address_commented_seq: CommentedSeq = None