From aa770073c44986969b48a8b3bbc42ff13fce7e55 Mon Sep 17 00:00:00 2001 From: Dennis Date: Sun, 3 Oct 2021 23:31:22 -0700 Subject: [PATCH] Ensure that file-log gets dumped in --out_dir --- srdl2sv/cli/cli.py | 8 +++++++- srdl2sv/main.py | 9 --------- 2 files changed, 7 insertions(+), 10 deletions(-) diff --git a/srdl2sv/cli/cli.py b/srdl2sv/cli/cli.py index 84eadd9..1601b0e 100644 --- a/srdl2sv/cli/cli.py +++ b/srdl2sv/cli/cli.py @@ -104,6 +104,12 @@ class CliArguments(): config['output_dir'] = args.out_dir config['list_args'].append('Ouput Directory : {}'.format(config['output_dir'])) + # Create output directory + try: + os.makedirs(config['output_dir']) + except FileExistsError: + pass + # Map logging level string to integers config['stream_log_level'] = logging_map[args.stream_log_level] config['file_log_level'] = logging_map[args.file_log_level] @@ -125,7 +131,7 @@ class CliArguments(): # Determine name of file to hold logs ts = time.strftime('%Y%m%d_%H%M%S', config['ts']) - config['file_log_location'] = "srdl2sv_{}.log".format(ts) + config['file_log_location'] = "/".join([config['output_dir'], "srdl2sv_{}.log".format(ts)]) # Tab style config['real_tabs'] = args.real_tabs diff --git a/srdl2sv/main.py b/srdl2sv/main.py index fa405ac..8f9d9c4 100755 --- a/srdl2sv/main.py +++ b/srdl2sv/main.py @@ -47,15 +47,6 @@ if __name__ == "__main__": addrmap = AddrMap(root.top, config) - # Create output directory - try: - os.makedirs(config['output_dir']) - logger.info('Succesfully created directory "{}"'.format( - config['output_dir'])) - except FileExistsError: - logger.info('Directory "{}" does already exist'.format( - config['output_dir'])) - # Save RTL to file # Start out with addrmap out_addrmap_file = "{}/{}.sv".format(config['output_dir'], addrmap.name)