Skip to content

Commit b3c3137

Browse files
committed
Purge when updating symlinks.
1 parent f5f087a commit b3c3137

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

build_docs.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -941,6 +941,7 @@ def symlink(www_root: Path, language: Language, directory: str, name: str, group
941941
link.unlink()
942942
link.symlink_to(directory)
943943
run(["chown", "-h", ":" + group, str(link)])
944+
purge_path(www_root, link)
944945

945946

946947
def major_symlinks(www_root: Path, group):
@@ -997,6 +998,13 @@ def proofread_canonicals(www_root: Path, skip_cache_invalidation: bool) -> None:
997998
requests.request("PURGE", url)
998999

9991000

1001+
def purge_path(www_root: Path, path: Path):
1002+
to_purge = [str(file.relative_to(www_root)) for file in path.glob("**/*")]
1003+
to_purge.append(str(path.relative_to(www_root)))
1004+
to_purge.append(str(path.relative_to(www_root)) + "/")
1005+
run(["curl", "-XPURGE", f"https://docs.python.org/{{{','.join(to_purge)}}}"])
1006+
1007+
10001008
def main():
10011009
"""Script entry point."""
10021010
args = parse_args()

0 commit comments

Comments
 (0)