Skip to content

Fix paths given to compiler.is_outdated. #543

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Feb 22, 2016

Conversation

davidt
Copy link
Contributor

@davidt davidt commented Feb 18, 2016

The check to see whether or not a source file is outdated was being passed the
input_path and output_path variables, which are not the actual paths to
files on disk. In particular, input_path is the path which will be searched
for using the staticfiles finders, and output_path is the relative path
within 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 and outfile instead means that the check
operates 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.

The check to see whether or not a source file is outdated was being passed the
`input_path` and `output_path` variables, which are not the actual paths to
files on disk. In particular, `input_path` is the path which will be searched
for using the staticfiles finders, and `output_path` is the relative path
within 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` and `outfile` instead means that the check
operates 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.
davidt added a commit that referenced this pull request Feb 22, 2016
Fix paths given to compiler.is_outdated.
@davidt davidt merged commit 0ed51f7 into jazzband:master Feb 22, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants