Skip to content

Commit 930b12c

Browse files
committed
Switch to using os.path for outdated file checks in compilers.
The outdated file checks in the compilers were using django storages to check file existence and compare mtimes, but with my recent change (which restored the older behavior of comparing the infile and outfile), these were operating on absolute, local files, which could result in a SuspiciousFileOperation. The compilers always operate on local files, so we can switch to using the os.path methods for these instead. This is both more correct and more efficient.
1 parent 2507820 commit 930b12c

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

pipeline/compilers/__init__.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -79,11 +79,12 @@ def output_path(self, path, extension):
7979
return '.'.join((path[0], extension))
8080

8181
def is_outdated(self, infile, outfile):
82-
if not self.storage.exists(outfile):
82+
if not os.path.exists(outfile):
8383
return True
84+
8485
try:
85-
return self.storage.modified_time(infile) > self.storage.modified_time(outfile)
86-
except (OSError, NotImplementedError):
86+
return os.path.getmtime(infile) > os.path.getmtime(outfile)
87+
except OSError:
8788
return True
8889

8990

0 commit comments

Comments
 (0)