Skip to content
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

Add logging in post-build tasks #221

Merged
merged 1 commit into from
Oct 21, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions build_docs.py
Original file line number Diff line number Diff line change
Expand Up @@ -424,6 +424,7 @@ def copy_robots_txt(
if not www_root.exists():
logging.info("Skipping copying robots.txt (www root does not even exist).")
return
logging.info("Copying robots.txt...")
template_path = HERE / "templates" / "robots.txt"
robots_path = www_root / "robots.txt"
shutil.copyfile(template_path, robots_path)
Expand All @@ -440,6 +441,7 @@ def build_sitemap(
if not www_root.exists():
logging.info("Skipping sitemap generation (www root does not even exist).")
return
logging.info("Starting sitemap generation...")
template_path = HERE / "templates" / "sitemap.xml"
template = jinja2.Template(template_path.read_text(encoding="UTF-8"))
rendered_template = template.render(languages=languages, versions=versions)
Expand All @@ -454,6 +456,7 @@ def build_404(www_root: Path, group):
if not www_root.exists():
logging.info("Skipping 404 page generation (www root does not even exist).")
return
logging.info("Copying 404 page...")
not_found_file = www_root / "404.html"
shutil.copyfile(HERE / "templates" / "404.html", not_found_file)
not_found_file.chmod(0o664)
Expand Down Expand Up @@ -1022,6 +1025,7 @@ def major_symlinks(
- /fr/3/ → /fr/3.9/
- /es/3/ → /es/3.9/
"""
logging.info("Creating major version symlinks...")
current_stable = Version.current_stable(versions).name
for language in languages:
symlink(
Expand Down Expand Up @@ -1051,6 +1055,7 @@ def dev_symlink(
- /fr/dev/ → /fr/3.11/
- /es/dev/ → /es/3.11/
"""
logging.info("Creating development version symlinks...")
current_dev = Version.current_dev(versions).name
for language in languages:
symlink(
Expand Down Expand Up @@ -1096,6 +1101,7 @@ def proofread_canonicals(
- /3.11/whatsnew/3.11.html typically would link to
/3/whatsnew/3.11.html, which may not exist yet.
"""
logging.info("Checking canonical links...")
canonical_re = re.compile(
"""<link rel="canonical" href="https://docs.python.org/([^"]*)" />"""
)
Expand Down