From 9d69300113d7e62c01b2a6d7f9d2fc745c6a2da7 Mon Sep 17 00:00:00 2001
From: Stephan Seitz <stephan.seitz@fau.de>
Date: Sat, 13 Feb 2021 02:05:08 +0100
Subject: [PATCH] Fix `clear_cache_on_start` in pystencils.json

Due two weird recursive dependencies `clear_cache` will not be
available at this point. In-lining this function will make
the config key `cache.clear_cache_on_start: true` work again.
---
 pystencils/cpu/cpujit.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/pystencils/cpu/cpujit.py b/pystencils/cpu/cpujit.py
index 37f8b5606..84908dcb2 100644
--- a/pystencils/cpu/cpujit.py
+++ b/pystencils/cpu/cpujit.py
@@ -194,7 +194,7 @@ def read_config():
         config['cache']['object_cache'] = os.path.expanduser(config['cache']['object_cache']).format(pid=os.getpid())
 
         if config['cache']['clear_cache_on_start']:
-            clear_cache()
+            shutil.rmtree(config['cache']['object_cache'], ignore_errors=True)
 
         create_folder(config['cache']['object_cache'], False)
 
-- 
GitLab