Skip to content

Commit

Permalink
Prevent running scan_locs() more than once
Browse files Browse the repository at this point in the history
  • Loading branch information
da2x committed Sep 7, 2015
1 parent f425710 commit 32e93e2
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions nikola/plugins/task/sitemap/__init__.py
Expand Up @@ -140,6 +140,9 @@ def gen_tasks(self):
urlset = {}

def scan_locs():
# No need to run this more than once
if urlset:
return True
"""Scan site locations."""
for root, dirs, files in os.walk(output, followlinks=True):
if not dirs and not files and not kw['sitemap_include_fileless_dirs']:
Expand Down Expand Up @@ -290,6 +293,8 @@ def scan_locs_task():

return {'file_dep': file_dep}

scan_locs()

yield {
"basename": "_scan_locs",
"name": "sitemap",
Expand All @@ -298,8 +303,6 @@ def scan_locs_task():

yield self.group_task()

scan_locs()

for sitemap_path in sorted(urlset.keys()):
# TODO: Fix issue #1683
sitemap = urlset[sitemap_path]
Expand Down

0 comments on commit 32e93e2

Please sign in to comment.