Skip to content

Commit 51ea439

Browse files
Shareef Jalloqolofk
authored andcommitted
Add core filename to output of fusesoc core show.
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
1 parent a86a5ca commit 51ea439

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

fusesoc/capi2/core.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,7 @@ def __init__(
3333

3434
self.cache_root = cache_root
3535

36-
basename = os.path.basename(self.core_file)
37-
36+
self.core_basename = os.path.basename(self.core_file)
3837
self.core_root = os.path.dirname(self.core_file)
3938

4039
# Populated by CoreDB._solve(). TODO: Find a better solution for that.
@@ -516,6 +515,7 @@ def info(self):
516515
Name: {}
517516
Description: {}
518517
Core root: {}
518+
Core file: {}
519519
520520
Targets:
521521
{}"""
@@ -539,6 +539,7 @@ def info(self):
539539
str(self.name),
540540
str(self.get_description() or "<No description>"),
541541
str(self.core_root),
542+
str(self.core_basename),
542543
targets,
543544
)
544545

tests/test_capi2.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -635,7 +635,11 @@ def test_capi2_info():
635635
core = Core(Core2Parser(), core_file)
636636

637637
gen_info = "\n".join(
638-
[x for x in core.info().split("\n") if not "Core root" in x]
638+
[
639+
x
640+
for x in core.info().split("\n")
641+
if not any([y in x for y in ["Core root", "Core file"]])
642+
]
639643
)
640644
with open(os.path.join(tests_dir, __name__, core_name + ".info")) as f:
641645
assert f.read() == gen_info, core_name

0 commit comments

Comments
 (0)