Ensure that file-log gets dumped in --out_dir

This commit is contained in:
Dennis Potter 2021-10-03 23:31:22 -07:00
parent 7d5ddaf47c
commit aa770073c4
Signed by: Dennis
GPG Key ID: 186A8AD440942BAF
2 changed files with 7 additions and 10 deletions

View File

@ -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

View File

@ -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)