Skip to content
Snippets Groups Projects
Commit 96b9fbe5 authored by Michael Kuron's avatar Michael Kuron :mortar_board:
Browse files

clear cache when compiler flags have changed

parent bce2cd81
No related branches found
No related tags found
1 merge request!240Incorporate header files and compiler flags into object cache hash
Pipeline #31765 passed
......@@ -205,10 +205,23 @@ def read_config():
if config['cache']['object_cache'] is not False:
config['cache']['object_cache'] = os.path.expanduser(config['cache']['object_cache']).format(pid=os.getpid())
if config['cache']['clear_cache_on_start']:
clear_cache = False
cache_status_file = os.path.join(config['cache']['object_cache'], 'last_config.json')
if os.path.exists(cache_status_file):
# check if compiler config has changed
last_config = json.load(open(cache_status_file, 'r'))
if set(last_config.items()) != set(config['compiler'].items()):
clear_cache = True
else:
for key in last_config.keys():
if last_config[key] != config['compiler'][key]:
clear_cache = True
if config['cache']['clear_cache_on_start'] or clear_cache:
shutil.rmtree(config['cache']['object_cache'], ignore_errors=True)
create_folder(config['cache']['object_cache'], False)
json.dump(config['compiler'], open(cache_status_file, 'w'), indent=4)
if config['compiler']['os'] == 'windows':
from pystencils.cpu.msvc_detection import get_environment
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment