summaryrefslogtreecommitdiff
path: root/giscanner/cachestore.py
diff options
context:
space:
mode:
Diffstat (limited to 'giscanner/cachestore.py')
-rw-r--r--giscanner/cachestore.py10
1 files changed, 7 insertions, 3 deletions
diff --git a/giscanner/cachestore.py b/giscanner/cachestore.py
index e98b52f1..baaaf1ed 100644
--- a/giscanner/cachestore.py
+++ b/giscanner/cachestore.py
@@ -106,8 +106,12 @@ class CacheStore(object):
return os.path.join(self._directory, hexdigest)
def _cache_is_valid(self, store_filename, filename):
- return (os.stat(store_filename).st_mtime >=
- os.stat(filename).st_mtime)
+ try:
+ store_mtime = os.stat(store_filename).st_mtime
+ except FileNotFoundError:
+ return False
+
+ return store_mtime >= os.stat(filename).st_mtime
def _remove_filename(self, filename):
try:
@@ -130,7 +134,7 @@ class CacheStore(object):
if store_filename is None:
return
- if (os.path.exists(store_filename) and self._cache_is_valid(store_filename, filename)):
+ if self._cache_is_valid(store_filename, filename):
return None
tmp_fd, tmp_filename = tempfile.mkstemp(prefix='g-ir-scanner-cache-')