Skip to content

Commit

Permalink
Making sure that .dep file is always generated, and listing it as tar…
Browse files Browse the repository at this point in the history
…get for render_posts plugin.
  • Loading branch information
felixfontein committed Oct 25, 2016
1 parent 0941466 commit 6470755
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 8 deletions.
3 changes: 2 additions & 1 deletion nikola/plugins/task/posts.py
Expand Up @@ -84,12 +84,13 @@ def tl_ch():
k = p.split('####MAGIC####CONFIG:', 1)[-1]
deps_dict[k] = self.site.config.get(k)
dest = post.translated_base_path(lang)
dep_file = dest + '.dep'
file_dep = [p for p in post.fragment_deps(lang) if not p.startswith("####MAGIC####")]
task = {
'basename': self.name,
'name': dest,
'file_dep': file_dep,
'targets': [dest],
'targets': [dest, dep_file],
'actions': [(post.compile, (lang, )),
(update_deps, (post, lang, )),
],
Expand Down
10 changes: 3 additions & 7 deletions nikola/post.py
Expand Up @@ -464,13 +464,9 @@ def register_depfile(self, dep, dest=None, lang=None):
def write_depfile(dest, deps_list):
"""Write a depfile for a given language."""
deps_path = dest + '.dep'
if deps_list:
deps_list = [p for p in deps_list if p != dest] # Don't depend on yourself (#1671)
with io.open(deps_path, "w+", encoding="utf8") as deps_file:
deps_file.write('\n'.join(deps_list))
else:
if os.path.isfile(deps_path):
os.unlink(deps_path)
deps_list = [p for p in deps_list if p != dest] # Don't depend on yourself (#1671)
with io.open(deps_path, "w+", encoding="utf8") as deps_file:
deps_file.write('\n'.join(deps_list))

def _get_dependencies(self, deps_list):
deps = []
Expand Down

0 comments on commit 6470755

Please sign in to comment.