Skip to content

Commit 1509a2c

Browse files
authored
Merge pull request #11105 from jimchamp/fix-sitemap-generation
Fix I/O errors during sitemap generation
2 parents 3865442 + 2ff0aaf commit 1509a2c

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

scripts/sitemaps/sitemap.py

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -146,18 +146,18 @@ def generate_sitemaps(filename: str) -> None:
146146
with open(filename) as f:
147147
rows = (line.strip().split("\t") for line in f)
148148

149-
for sortkey, chunk in itertools.groupby(rows, lambda row: row[0]):
150-
things = []
151-
152-
_chunk = list(chunk)
153-
for segment in _chunk:
154-
sortkey = segment.pop(0)
155-
last_modified = segment.pop(-1)
156-
path = ''.join(segment)
157-
things.append(web.storage(path=path, last_modified=last_modified))
158-
159-
if things:
160-
write(f"sitemaps/sitemap_{sortkey}.xml.gz", sitemap(things))
149+
for sortkey, chunk in itertools.groupby(rows, lambda row: row[0]):
150+
things = []
151+
152+
_chunk = list(chunk)
153+
for segment in _chunk:
154+
sortkey = segment.pop(0)
155+
last_modified = segment.pop(-1)
156+
path = ''.join(segment)
157+
things.append(web.storage(path=path, last_modified=last_modified))
158+
159+
if things:
160+
write(f"sitemaps/sitemap_{sortkey}.xml.gz", sitemap(things))
161161

162162

163163
@elapsed_time("generate_siteindex")

0 commit comments

Comments
 (0)