Merge branch 'bugfix/archive_details_always_run_like_diff_v4.3' into 'release/v4.3'

tools: fix bug with idf_size argument archive_details (v4.3)

See merge request espressif/esp-idf!15775
pull/7964/head
Roland Dobai 2021-11-23 07:30:54 +00:00
commit 82144c913c
2 zmienionych plików z 759 dodań i 784 usunięć

Wyświetl plik

@ -1136,7 +1136,7 @@ class StructureForArchiveSymbols(object):
def get_archive_symbols(sections, archive, as_json=False, sections_diff=None): # type: (Dict, str, bool, Dict) -> str
diff_en = sections_diff is not None
diff_en = bool(sections_diff)
current = StructureForArchiveSymbols.get(archive, sections)
reference = StructureForArchiveSymbols.get(archive, sections_diff) if sections_diff else {}
@ -1160,19 +1160,29 @@ def get_archive_symbols(sections, archive, as_json=False, sections_diff=None):
def _get_item_pairs(name, section): # type: (str, collections.OrderedDict) -> collections.OrderedDict
return collections.OrderedDict([(key.replace(name + '.', ''), val) for key, val in iteritems(section)])
def _get_max_len(symbols_dict): # type: (Dict) -> Tuple[int, int]
# the lists have 0 in them because max() doesn't work with empty lists
names_max_len = 0
numbers_max_len = 0
for t, s in iteritems(symbols_dict):
numbers_max_len = max([numbers_max_len] + [len(str(x)) for _, x in iteritems(s)])
names_max_len = max([names_max_len] + [len(x) for x in _get_item_pairs(t, s)])
return names_max_len, numbers_max_len
def _get_output(section_symbols): # type: (Dict) -> str
output = ''
names_max_len, numbers_max_len = _get_max_len(section_symbols)
for t, s in iteritems(section_symbols):
output += '{}Symbols from section: {}{}'.format(os.linesep, t, os.linesep)
item_pairs = _get_item_pairs(t, s)
output += ' '.join(['{}({})'.format(key, val) for key, val in iteritems(item_pairs)])
for key, val in iteritems(item_pairs):
output += ' '.join([('\t{:<%d} : {:>%d}\n' % (names_max_len,numbers_max_len)).format(key, val)])
section_total = sum([val for _, val in iteritems(item_pairs)])
output += '{}Section total: {}{}'.format(os.linesep if section_total > 0 else '',
section_total,
os.linesep)
output += 'Section total: {}{}'.format(section_total, os.linesep)
return output
output = 'Symbols within the archive: {} (Not all symbols may be reported){}'.format(archive, os.linesep)
output = '{}Symbols within the archive: {} (Not all symbols may be reported){}'.format(os.linesep, archive, os.linesep)
if diff_en:
def _generate_line_tuple(curr, ref, name):