-
-
Notifications
You must be signed in to change notification settings - Fork 33.2k
Doc: Convert the download page to reST #124614
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
Closed
Closed
Changes from 1 commit
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,59 @@ | ||
| :orphan: | ||
|
|
||
| .. title:: Download | ||
|
|
||
| ************************************************ | ||
| Download Python |archives_version| Documentation | ||
| ************************************************ | ||
|
|
||
| **Last updated on:** |last_updated| | ||
|
|
||
| .. |last_updated| date:: %b %d, %Y (%H:%M) | ||
|
|
||
| To download an archive containing all the documents for this version of | ||
| Python in one of various formats, follow one of links in this table. | ||
|
|
||
| .. list-table:: | ||
| :align: left | ||
| :header-rows: 1 | ||
|
|
||
| * - Format | ||
| - Packed as .zip | ||
| - Packed as .tar.bz2 | ||
|
|
||
| - :download-archive:`python-$VERSION-docs-pdf-a4.zip` (c. 17 MiB) | ||
| - :download-archive:`python-$VERSION-docs-pdf-a4.tar.bz2` (c. 17 MiB) | ||
|
|
||
| * - HTML | ||
| - :download-archive:`python-$VERSION-docs-html.zip` (c. 13 MiB) | ||
| - :download-archive:`python-$VERSION-docs-html.tar.bz2` (c. 8 MiB) | ||
|
|
||
| * - Plain text | ||
| - :download-archive:`python-$VERSION-docs-text.zip` (c. 4 MiB) | ||
| - :download-archive:`python-$VERSION-docs-text.tar.bz2` (c. 3 MiB) | ||
|
|
||
| * - Texinfo | ||
| - :download-archive:`python-$VERSION-docs-texinfo.zip` (c. 9 MiB) | ||
| - :download-archive:`python-$VERSION-docs-texinfo.tar.bz2` (c. 7 MiB) | ||
|
|
||
| * - EPUB | ||
| - :download-archive:`python-$VERSION-docs.epub` (c. 6 MiB) | ||
| - | ||
|
|
||
| These archives contain all the content in the documentation. | ||
|
|
||
|
|
||
| Unpacking | ||
| ========= | ||
|
|
||
| Unix users should download the ``.tar.bz2`` archives; | ||
| these are bzipped tar archives and can be handled in the usual way | ||
| using the :program:`tar` and :program:`bzip2` programmes. | ||
| :program:`unzip` from `Info-ZIP`_ can be used with the ZIP archives if desired. | ||
| The ``.tar.bz2`` archives provide the best compression and download times. | ||
|
|
||
| Windows users can use the ZIP archives, | ||
| which are created on Unix using :program:`zip` from `Info-ZIP`_. | ||
|
|
||
| .. _Info-ZIP: https://infozip.sourceforge.net/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,56 @@ | ||
| """Support for the download page. | ||
|
|
||
| When the documentation is built and served from the docs server, | ||
| we prefer to link to the `up-to-date archives`_ instead of the | ||
| static releases on the python.org FTP site. | ||
| In an attempt to reduce confusion about these archives, | ||
| we re-title the page with the short version (major.minor) | ||
| instead of a full release version. | ||
|
|
||
| Contents: | ||
|
|
||
| * The ``:download-archive:`` role implements variable download links. | ||
| * The ``download_only_html()`` function prevents building the download | ||
| page on non-HTML builders. | ||
|
|
||
| .. _up-to-date archives: https://docs.python.org/3/archives/ | ||
| """ | ||
|
|
||
| from __future__ import annotations | ||
|
|
||
| from typing import TYPE_CHECKING | ||
|
|
||
| from docutils import nodes | ||
| from sphinx.locale import _ as sphinx_gettext | ||
| from sphinx.util.docutils import SphinxRole | ||
|
|
||
| if TYPE_CHECKING: | ||
| from docutils.nodes import Node, system_message | ||
| from sphinx.application import Sphinx | ||
|
|
||
|
|
||
| class DownloadArchiveRole(SphinxRole): | ||
| def run(self) -> tuple[list[Node], list[system_message]]: | ||
| tags = self.env.app.tags | ||
| if "daily" in tags and "format_html" in tags: | ||
| dl_base = "archives/" | ||
| dl_version = self.config.version | ||
| else: | ||
| dl_base = "https://www.python.org/ftp/python/doc/" | ||
| dl_version = self.config.release | ||
|
|
||
| ref_text = sphinx_gettext("Download") | ||
| uri = dl_base + self.text.replace("$VERSION", dl_version) | ||
| refnode = nodes.reference("Download", ref_text, refuri=uri) | ||
| return [refnode], [] | ||
|
|
||
|
|
||
| def download_only_html(app: Sphinx) -> None: | ||
| """Don't create the download page for non-HTML builders.""" | ||
| if "format_html" not in app.tags: | ||
| app.config.exclude_patterns.append("download.rst") | ||
|
|
||
|
|
||
| def setup(app): | ||
| app.add_role("download-archive", DownloadArchiveRole()) | ||
| app.connect("builder-inited", download_only_html) |
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sphinx injects
tagsinto theconf.pynamespace.