Make manage_cache backwards compatible.

- Old caches don't have checksum files.
This commit is contained in:
Andrew Hamilton 2021-12-16 00:41:22 +10:00
parent 321ed11ffe
commit 7abf025671

View file

@ -1090,8 +1090,11 @@ def manage_cache(root_path):
cache_path = os.path.join(root_path, tools.CACHE_PATH)
checksum_path = os.path.join(cache_path, "source_checksum")
if os.path.exists(cache_path):
with open(checksum_path, "r") as checksum_file:
cache_checksum = checksum_file.read()
try:
with open(checksum_path, "r") as checksum_file:
cache_checksum = checksum_file.read()
except FileNotFoundError:
cache_checksum = None
if source_checksum() != cache_checksum:
print("Eris has changed, recalculating all results…")
shutil.rmtree(cache_path)