Fix paths given to compiler.is_outdated. #543
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The check to see whether or not a source file is outdated was being passed the
input_path
andoutput_path
variables, which are not the actual paths tofiles on disk. In particular,
input_path
is the path which will be searchedfor using the staticfiles finders, and
output_path
is the relative pathwithin the staticfiles root. If the staticfiles root was not the same as the
root directory of the project, this would result in the check always reporting
that the file was outdated. In addition, if a source file required a finder to
locate, the check would fail.
Changing this to use
infile
andoutfile
instead means that the checkoperates on the same file paths that the compiler will. This therefore checks
the files that were copied by the collector against the files which are
outputted by the compiler, which is a much more correct idea of whether
something is out of date.
This was tested in conjunction with a custom LessCompiler that uses a helper to
introspect dependencies. Before this change, that helper was seeing file paths
that did not exist (since STATIC_ROOT is a few subdirectories deep in our
codebase). Afterwards, it is able to successfully introspect all the source
files to build the dependency tree.