Added possibility to log files where Symbolator failed to generate plots

Signed-off-by: Grzegorz Latosinski <glatosinski@antmicro.com>
This commit is contained in:
Grzegorz Latosinski 2020-11-17 00:26:20 +01:00
parent 35199ce0e1
commit 60e4b48110
1 changed files with 44 additions and 35 deletions

View File

@ -42,6 +42,11 @@ def main(argv):
help='Create directories for output when not present',
action='store_true'
)
parser.add_argument(
'--failed-inputs',
help='Path to files for which Symbolator failed to generate diagram',
type=Path
)
args = parser.parse_args(argv[1:])
@ -49,6 +54,9 @@ def main(argv):
symbol_v_files = libraries_dir.rglob('*.symbol.v')
nc = contextlib.nullcontext()
with open(args.failed_inputs, 'w') if args.failed_inputs else nc as err:
for symbol_v_file in symbol_v_files:
if args.libname and args.libname != symbol_v_file.parts[1]:
continue
@ -68,7 +76,7 @@ def main(argv):
out_dir.mkdir(parents=True)
else:
print(f'The output directory {str(out_dir)} is missing')
print('Run the script with --create-dirs to make directories')
print('Run the script with --create-dirs')
return errno.ENOENT
if out_filename.exists():
@ -88,6 +96,7 @@ def main(argv):
)
print('Error message:\n', file=sys.stderr)
traceback.print_exc()
err.write(f'{symbol_v_file}\n')
return 0