mirror of
https://github.com/espressif/esp-idf.git
synced 2025-07-30 10:47:19 +02:00
Merge branch 'bugfix/archive_details_always_run_like_diff_v4.4' into 'release/v4.4'
tools: fix bug with idf_size argument archive_details (v4.4) See merge request espressif/esp-idf!15774
This commit is contained in:
@ -1079,7 +1079,7 @@ class StructureForArchiveSymbols(object):
|
|||||||
|
|
||||||
|
|
||||||
def get_archive_symbols(sections: Dict, archive: str, as_json: bool=False, sections_diff: Dict=None) -> str:
|
def get_archive_symbols(sections: Dict, archive: str, as_json: bool=False, sections_diff: Dict=None) -> str:
|
||||||
diff_en = sections_diff is not None
|
diff_en = bool(sections_diff)
|
||||||
current = StructureForArchiveSymbols.get(archive, sections)
|
current = StructureForArchiveSymbols.get(archive, sections)
|
||||||
reference = StructureForArchiveSymbols.get(archive, sections_diff) if sections_diff else {}
|
reference = StructureForArchiveSymbols.get(archive, sections_diff) if sections_diff else {}
|
||||||
|
|
||||||
@ -1103,19 +1103,29 @@ def get_archive_symbols(sections: Dict, archive: str, as_json: bool=False, secti
|
|||||||
def _get_item_pairs(name: str, section: collections.OrderedDict) -> collections.OrderedDict:
|
def _get_item_pairs(name: str, section: collections.OrderedDict) -> collections.OrderedDict:
|
||||||
return collections.OrderedDict([(key.replace(name + '.', ''), val) for key, val in iteritems(section)])
|
return collections.OrderedDict([(key.replace(name + '.', ''), val) for key, val in iteritems(section)])
|
||||||
|
|
||||||
|
def _get_max_len(symbols_dict: 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: Dict) -> str:
|
def _get_output(section_symbols: Dict) -> str:
|
||||||
output = ''
|
output = ''
|
||||||
|
names_max_len, numbers_max_len = _get_max_len(section_symbols)
|
||||||
for t, s in iteritems(section_symbols):
|
for t, s in iteritems(section_symbols):
|
||||||
output += '{}Symbols from section: {}{}'.format(os.linesep, t, os.linesep)
|
output += '{}Symbols from section: {}{}'.format(os.linesep, t, os.linesep)
|
||||||
item_pairs = _get_item_pairs(t, s)
|
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)])
|
section_total = sum([val for _, val in iteritems(item_pairs)])
|
||||||
output += '{}Section total: {}{}'.format(os.linesep if section_total > 0 else '',
|
output += 'Section total: {}{}'.format(section_total, os.linesep)
|
||||||
section_total,
|
|
||||||
os.linesep)
|
|
||||||
return output
|
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:
|
if diff_en:
|
||||||
|
|
||||||
def _generate_line_tuple(curr: collections.OrderedDict, ref: collections.OrderedDict, name: str) -> Tuple[str, int, int, str]:
|
def _generate_line_tuple(curr: collections.OrderedDict, ref: collections.OrderedDict, name: str) -> Tuple[str, int, int, str]:
|
||||||
|
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user