Purge temp at the start of every run if it exists.

This commit is contained in:
mrg 2020-12-02 11:09:40 -08:00
parent 0250d9add7
commit edf3d9557d
1 changed files with 29 additions and 22 deletions

View File

@ -354,16 +354,8 @@ def end_openram():
verify.print_pex_stats() verify.print_pex_stats()
def cleanup_paths(): def purge_temp():
""" """ Remove the temp directory. """
We should clean up the temp directory after execution.
"""
global OPTS
if OPTS.keep_temp:
debug.info(0,
"Preserving temp directory: {}".format(OPTS.openram_temp))
return
elif os.path.exists(OPTS.openram_temp):
debug.info(1, debug.info(1,
"Purging temp directory: {}".format(OPTS.openram_temp)) "Purging temp directory: {}".format(OPTS.openram_temp))
# This annoyingly means you have to re-cd into # This annoyingly means you have to re-cd into
@ -377,6 +369,19 @@ def cleanup_paths():
shutil.rmtree(i) shutil.rmtree(i)
def cleanup_paths():
"""
We should clean up the temp directory after execution.
"""
global OPTS
if OPTS.keep_temp:
debug.info(0,
"Preserving temp directory: {}".format(OPTS.openram_temp))
return
elif os.path.exists(OPTS.openram_temp):
purge_temp()
def setup_paths(): def setup_paths():
""" Set up the non-tech related paths. """ """ Set up the non-tech related paths. """
debug.info(2, "Setting up paths...") debug.info(2, "Setting up paths...")
@ -427,7 +432,9 @@ def find_exe(check_exe):
def init_paths(): def init_paths():
""" Create the temp and output directory if it doesn't exist """ """ Create the temp and output directory if it doesn't exist """
if os.path.exists(OPTS.openram_temp):
purge_temp()
else:
# make the directory if it doesn't exist # make the directory if it doesn't exist
try: try:
debug.info(1, debug.info(1,