Skip to content

Commit

Permalink
Add core filename to output of fusesoc core show.
Browse files Browse the repository at this point in the history
This commit updates the output of `fusesoc core show` to add the
filename of the core file itself. This change is required for tools such
as the filelist Edalize backend as discussed in
olofk/edalize#25.

The output of `fusesoc core show` now looks like:

CORE INFO
Name:        vee:el:en:vee
Description: Top bombing
Core root:   /root/path/to/core/file
Core file:   basename.core
  • Loading branch information
shareefj authored and olofk committed Sep 17, 2023
1 parent a86a5ca commit 51ea439
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
5 changes: 3 additions & 2 deletions fusesoc/capi2/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,7 @@ def __init__(

self.cache_root = cache_root

basename = os.path.basename(self.core_file)

self.core_basename = os.path.basename(self.core_file)
self.core_root = os.path.dirname(self.core_file)

# Populated by CoreDB._solve(). TODO: Find a better solution for that.
Expand Down Expand Up @@ -516,6 +515,7 @@ def info(self):
Name: {}
Description: {}
Core root: {}
Core file: {}
Targets:
{}"""
Expand All @@ -539,6 +539,7 @@ def info(self):
str(self.name),
str(self.get_description() or "<No description>"),
str(self.core_root),
str(self.core_basename),
targets,
)

Expand Down
6 changes: 5 additions & 1 deletion tests/test_capi2.py
Original file line number Diff line number Diff line change
Expand Up @@ -635,7 +635,11 @@ def test_capi2_info():
core = Core(Core2Parser(), core_file)

gen_info = "\n".join(
[x for x in core.info().split("\n") if not "Core root" in x]
[
x
for x in core.info().split("\n")
if not any([y in x for y in ["Core root", "Core file"]])
]
)
with open(os.path.join(tests_dir, __name__, core_name + ".info")) as f:
assert f.read() == gen_info, core_name
Expand Down

0 comments on commit 51ea439

Please sign in to comment.