Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Better error messages if hook script is not found
Currently, edalize raises an Exception if a hook script cannot be executed because it is not found: ``` Traceback (most recent call last): File "/home/philipp/.local/bin/fusesoc", line 11, in <module> load_entry_point('fusesoc', 'console_scripts', 'fusesoc')() File "/home/philipp/src/fusesoc/fusesoc/main.py", line 583, in main args.func(cm, args) File "/home/philipp/src/fusesoc/fusesoc/main.py", line 268, in run flags, args.system_name, args.system, args.backendargs, args.build_root) File "/home/philipp/src/fusesoc/fusesoc/main.py", line 357, in run_backend backend.build() File "/home/philipp/src/edalize/edalize/edatool.py", line 121, in build self.build_post() File "/home/philipp/src/edalize/edalize/edatool.py", line 133, in build_post self._run_scripts(self.hooks['post_build']) File "/home/philipp/src/edalize/edalize/edatool.py", line 283, in _run_scripts env = _env) File "/usr/lib64/python3.7/subprocess.py", line 342, in check_call retcode = call(*popenargs, **kwargs) File "/usr/lib64/python3.7/subprocess.py", line 323, in call with Popen(*popenargs, **kwargs) as p: File "/usr/lib64/python3.7/subprocess.py", line 775, in __init__ restore_signals, start_new_session) File "/usr/lib64/python3.7/subprocess.py", line 1522, in _execute_child raise child_exception_type(errno_num, err_msg, err_filename) FileNotFoundError: [Errno 2] No such file or directory: '../../../../../test/fpga_error_check.sh': '../../../../../test/fpga_error_check.sh' ``` After applying this patch, the user gets a more helpful error message: ``` INFO: Running post_build script fpga_error_check DEBUG: Environment: {'SHELL': '/bin/bash', ... } DEBUG: Working directory: /some/path/sim-verilator ERROR: Failed to build xxx:xxx:xxx:xxx : Unable to run post_build script 'fpga_error_check': [Errno 2] No such file or directory: '../../../../../test/fpga_error_check.sh': '../../../../../test/fpga_error_check.sh' ``` Note that the INFO and DEBUG output relies on olofk/fusesoc#307. The Environment debug line can be rather long (depending on the shell environment), but is very helpful for debugging script errors. Trading off a "nice log" for a "useful log" here.
- Loading branch information