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

Print a warning when building docs with a pre-release version of the theme #813

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
3 changes: 3 additions & 0 deletions babel.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,6 @@
encoding = utf-8
ignore_tags = script,style
include_attrs = alt title summary placeholder

# Extraction from Python files
[python: **.py]
1 change: 1 addition & 0 deletions docs/changelog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ Deprecated
----------

* Support for sphinx's html4 writer is deprecated and will be removed in version 2.0 (#1091)
* Installing from git is deprecated; Sphinx will warn if not using an official version of the theme.

Other Changes
-------------
Expand Down
13 changes: 12 additions & 1 deletion sphinx_rtd_theme/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
"""

from os import path
import pkg_resources

from sys import version_info as python_version

from sphinx import version_info as sphinx_version
Expand Down Expand Up @@ -33,9 +35,18 @@ def config_initiated(app, config):

# See http://www.sphinx-doc.org/en/stable/theming.html#distribute-your-theme-as-a-python-package
def setup(app):
app.require_sphinx('1.6')

# Warn if a prerelease version of the theme is used
parsed_version = pkg_resources.parse_version(__version__)
if parsed_version.is_prerelease:
logger.warning(_('You are using a pre-release version (%s) of sphinx-rtd-theme.'), __version__)
logger.warning(_('Use a stable release if you encounter problems.'))
logger.warning(_('See <https://sphinx-rtd-theme.readthedocs.io/en/stable/installing.html>.'))
Blendify marked this conversation as resolved.
Show resolved Hide resolved

if python_version[0] < 3:
logger.warning("Python 2 is deprecated with sphinx_rtd_theme, update to Python 3")
app.require_sphinx('1.6')

if sphinx_version <= (2, 0, 0):
logger.warning("Sphinx 1.x is deprecated with sphinx_rtd_theme, update to Sphinx 2.x or greater")
if not app.config.html_experimental_html5_writer:
Expand Down