Skip to content
Snippets Groups Projects

Incorporate header files and compiler flags into object cache hash

Merged Michael Kuron requested to merge hash into master
1 file
+ 14
1
Compare changes
  • Side-by-side
  • Inline
+ 14
1
@@ -205,10 +205,23 @@ def read_config():
@@ -205,10 +205,23 @@ def read_config():
if config['cache']['object_cache'] is not False:
if config['cache']['object_cache'] is not False:
config['cache']['object_cache'] = os.path.expanduser(config['cache']['object_cache']).format(pid=os.getpid())
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)
shutil.rmtree(config['cache']['object_cache'], ignore_errors=True)
create_folder(config['cache']['object_cache'], False)
create_folder(config['cache']['object_cache'], False)
 
json.dump(config['compiler'], open(cache_status_file, 'w'), indent=4)
if config['compiler']['os'] == 'windows':
if config['compiler']['os'] == 'windows':
from pystencils.cpu.msvc_detection import get_environment
from pystencils.cpu.msvc_detection import get_environment
Loading