scripts: footprint: Fix size_report on freestanding apps
os.path.commonpath() throws a ValueError exception when paths in the list provided share nothing in common (like for example two Windows paths on different drive letters). Handle that special case properly instead of letting the exception propagate up. Fixes #51549. Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
This commit is contained in:
parent
b6c80d16a1
commit
462dc9746b
1 changed files with 5 additions and 3 deletions
|
@ -520,8 +520,10 @@ def find_common_path_prefix(symbol_dict):
|
|||
for file in symbol['mapped_files']:
|
||||
paths.append(file)
|
||||
|
||||
return os.path.commonpath(paths)
|
||||
|
||||
try:
|
||||
return os.path.commonpath(paths)
|
||||
except ValueError:
|
||||
return None
|
||||
|
||||
class TreeNode(NodeMixin):
|
||||
"""
|
||||
|
@ -560,7 +562,7 @@ def generate_any_tree(symbol_dict, total_size, path_prefix):
|
|||
root = TreeNode('Root', "root")
|
||||
node_no_paths = TreeNode('(no paths)', ":", parent=root)
|
||||
|
||||
if Path(path_prefix) == Path(args.zephyrbase):
|
||||
if path_prefix and Path(path_prefix) == Path(args.zephyrbase):
|
||||
# All source files are under ZEPHYR_BASE so there is
|
||||
# no need for another level.
|
||||
node_zephyr_base = root
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue