8000 404 page for artifacts. · python/docsbuild-scripts@ca1f1e5 · GitHub
[go: up one dir, main page]

Skip to content

Commit ca1f1e5

Browse files
committed
404 page for artifacts.
1 parent 3319b55 commit ca1f1e5

File tree

2 files changed

+116
-0
lines changed

2 files changed

+116
-0
lines changed

build_docs.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -531,6 +531,14 @@ def build_sitemap(www_root: Path):
531531
)
532532

533533

534+
def build_404(www_root: Path):
535+
"""Build a nice 404 error page to display in case PDFs are not built yet."""
536+
if not www_root.exists():
537+
logging.info("Skipping 404 page generation (www root does not even exists).")
538+
return
539+
shutil.copyfile(HERE / "templates" / "404.html", www_root / "404.html")
540+
541+
534542
def head(text, lines=10):
535543
"""Return the first *lines* lines from the given text."""
536544
return "\n".join(text.split("\n")[:lines])
@@ -1011,6 +1019,7 @@ def main():
10111019
lock.close()
10121020

10131021
build_sitemap(args.www_root)
1022+
build_404(args.www_root)
10141023
build_robots_txt(args.www_root, args.group, args.skip_cache_invalidation)
10151024
major_symlinks(args.www_root, args.group)
10161025
dev_symlink(args.www_root, args.group)

templates/404.html

Lines changed: 107 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,107 @@
1+
<!DOCTYPE html>
2+
3+
<html>
4+
<head>
5+
<meta charset="utf-8" />
6+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
7+
<title>Archive not found</title><meta name="viewport" content="width=device-width, initial-scale=1.0">
8+
<link rel="stylesheet" href="/_static/pydoctheme.css" type="text/css" />
9+
<script id="documentation_options" data-url_root="./" src="/_static/documentation_options.js"></script>
10+
<script src="/_static/jquery.js"></script>
11+
<script src="/_static/underscore.js"></script>
12+
<script src="/_static/doctools.js"></script>
13+
<script src="/_static/language_data.js"></script>
14+
15+
<link rel="author" title="About these documents" href="about.html" />
16+
<link rel="index" title="Index" href="genindex.html" />
17+
<link rel="copyright" title="Copyright" href="copyright.html" />
18+
19+
<style>
20+
@media only screen {
21+
table.full-width-table {
22+
width: 100%;
23+
}
24+
}
25+
</style>
26+
<link rel="shortcut icon" type="image/png" href="/_static/py.svg" />
27+
</head>
28+
<body>
29+
<div class="mobile-nav">
30+
<input type="checkbox" id="menuToggler" class="toggler__input" aria-controls="navigation"
31+
aria-pressed="false" aria-expanded="false" role="button" aria-label="Menu" />
32+
<label for="menuToggler" class="toggler__label">
33+
<span></span>
34+
</label>
35+
<nav class="nav-content" role="navigation">
36+
<a href="https://www.python.org/" class="nav-logo">
37+
<img src="/_static/py.svg" alt="Logo"/>
38+
</a>
39+
<div class="version_switcher_placeholder"></div>
40+
</nav>
41+
<div class="menu-wrapper">
42+
<nav class="menu" role="navigation" aria-label="main navigation">
43+
<div class="language_switcher_placeholder"></div>
44+
</nav>
45+
</div>
46+
</div>
47+
48+
49+
<div class="related" role="navigation" aria-label="related navigation">
50+
<h3>Navigation</h3>
51+
<ul>
52+
<li class="right" style="margin-right: 10px">
53+
<li><img src="/_static/py.svg" alt="python logo" style="vertical-align: middle; margin-top: -1px"/></li>
54+
<li><a href="https://www.python.org/">Python</a> &#187;</li>
55+
<li class="switchers">
56+
<div class="language_switcher_placeholder"></div>
57+
<div class="version_switcher_placeholder"></div>
58+
</li>
59+
<li id="cpython-language-and-version"><a href="/">Documentation</a> &#187;</li>
60+
</ul>
61+
</div>
62+
<div class="document">
63+
<div class="documentwrapper">
64+
<div class="bodywrapper">
65+
<div class="body" role="main">
66+
<h1>404 — Archive Not Found</h1>
67+
<p>The archive you're trying to download has not been built yet.</p>
68+
<p>Please try again later.</p>
69+
<div class="clearer"></div>
70+
</div>
71+
</div>
72+
</div>
73+
<div class="clearer"></div>
74+
</div>
75+
<div class="related" role="navigation" aria-label="related navigation">
76+
<h3>Navigation</h3>
77+
<ul>
78+
<li class="right"></li>
79+
<li><img src="/_static/py.svg" alt="python logo" style="vertical-align: middle; margin-top: -1px"/></li>
80+
<li><a href="https://www.python.org/">Python</a> &#187;</li>
81+
<li class="switchers">
82+
<div class="language_switcher_placeholder"></div>
83+
<div class="version_switcher_placeholder"></div>
84+
</li>
85+
<li id="cpython-language-and-version">
86+
<a href="/">Documentation</a> &#187;
87+
</li>
88+
</ul>
89+
</div>
90+
<div class="footer">
91+
&copy; <a href="/copyright.html">Copyright</a> 2001-2022, Python Software Foundation.
92+
<br />
93+
This page is licensed under the Python Software Foundation License Version 2.
94+
<br />
95+
Examples, recipes, and other code in the documentation are additionally licensed under the Zero Clause BSD License.
96+
<br />
97+
See <a href="/license.html">History and License</a> for more information.<br />
98+
<br />
99+
The Python Software Foundation is a non-profit corporation.
100+
<a href="https://www.python.org/psf/donations/">Please donate.</a>
101+
<br />
102+
<a href="/bugs.html">Found a bug</a>?
103+
<br />
104+
</div>
105+
<script type="text/javascript" src="/_static/switchers.js"></script>
106+
</body>
107+
</html>

0 commit comments

Comments
 (0)
0