Commit ca0bdf32 by Rémy Sanchez Committed by Timothée Peignier

move is_outdated to compiler

parent d1182201
...@@ -37,6 +37,7 @@ or just made Pipeline more awesome. ...@@ -37,6 +37,7 @@ or just made Pipeline more awesome.
* Peter Baumgartner <pete@lincolnloop.com> * Peter Baumgartner <pete@lincolnloop.com>
* Pierre Drescher <pierre.drescher@gmail.com> * Pierre Drescher <pierre.drescher@gmail.com>
* Remco Wendt <remco@maykinmedia.nl> * Remco Wendt <remco@maykinmedia.nl>
* Remy Sanchez <remy.sanchez@hyperthese.net>
* Sam Thomson <sammthomson@gmail.com> * Sam Thomson <sammthomson@gmail.com>
* Sander Smits <jhmsmits@gmail.com> * Sander Smits <jhmsmits@gmail.com>
* Sirex <sirexas@gmail.com> * Sirex <sirexas@gmail.com>
......
...@@ -37,7 +37,7 @@ class Compiler(object): ...@@ -37,7 +37,7 @@ class Compiler(object):
outfile = self.output_path(infile, compiler.output_extension) outfile = self.output_path(infile, compiler.output_extension)
outdated = True outdated = True
else: else:
outdated = self.is_outdated(input_path, output_path) outdated = compiler.is_outdated(infile, outfile)
try: try:
compiler.compile_file(infile, outfile, outdated=outdated, force=force) compiler.compile_file(infile, outfile, outdated=outdated, force=force)
except CompilerError: except CompilerError:
...@@ -53,12 +53,6 @@ class Compiler(object): ...@@ -53,12 +53,6 @@ class Compiler(object):
path = os.path.splitext(path) path = os.path.splitext(path)
return '.'.join((path[0], extension)) return '.'.join((path[0], extension))
def is_outdated(self, infile, outfile):
try:
return self.storage.modified_time(infile) > self.storage.modified_time(outfile)
except (OSError, NotImplementedError):
return True
class CompilerBase(object): class CompilerBase(object):
def __init__(self, verbose, storage): def __init__(self, verbose, storage):
...@@ -80,6 +74,12 @@ class CompilerBase(object): ...@@ -80,6 +74,12 @@ class CompilerBase(object):
file.close() file.close()
return content return content
def is_outdated(self, infile, outfile):
try:
return self.storage.modified_time(infile) > self.storage.modified_time(outfile)
except (OSError, NotImplementedError):
return True
class SubProcessCompiler(CompilerBase): class SubProcessCompiler(CompilerBase):
def execute_command(self, command, content=None, cwd=None): def execute_command(self, command, content=None, cwd=None):
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment