Skip to content

Commit b0e45b3

Browse files
authored
Print directory change notifications around tool execution
Summary Print Entering directory '...' and Leaving directory '...' around tool invocations in _run_tool() Enables editors (Emacs, etc.) to resolve file paths in tool output when running from a build directory Motivation When edalize runs a tool (e.g. slang for linting), it sets cwd=self.work_root, so the tool reports file paths relative to the build directory. Editors that parse compiler output (like Emacs compilation-mode) cannot resolve these paths back to the source files. GNU Make solved this with Entering directory / Leaving directory messages. This patch adds the same convention to edalize so that editor integrations work out of the box. Test plan Run any edalize-backed tool (e.g. fusesoc run --target=slanglint ...) Verify Entering directory and Leaving directory appear in output Verify editor can resolve relative file paths in tool output to correct source locations
1 parent 20b3510 commit b0e45b3

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

edalize/edatool.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -568,6 +568,8 @@ def _run_tool(self, cmd, args=[], quiet=False):
568568
logger.debug("args : " + " ".join(args))
569569

570570
capture_output = quiet and not (self.verbose or self.stdout or self.stderr)
571+
abs_work_root = os.path.abspath(self.work_root)
572+
print(f"Entering directory '{abs_work_root}'")
571573
try:
572574
cp = run(
573575
[cmd] + args,
@@ -593,6 +595,7 @@ def _run_tool(self, cmd, args=[], quiet=False):
593595
logger.debug(e.stderr)
594596

595597
raise RuntimeError(_s)
598+
print(f"Leaving directory '{abs_work_root}'")
596599
return cp.returncode, cp.stdout, cp.stderr
597600

598601
def _filter_verilog_files(src_file):

0 commit comments

Comments
 (0)