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 @@ -20,6 +20,7 @@ Other Changes
* Added Spanish translation
* Added i18n support using Babel
* Moved build system from Grunt and friends to Webpack
* Warn when using a pre-release version of the theme

0.4.3
======
Expand Down
19 changes: 19 additions & 0 deletions sphinx_rtd_theme/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,25 @@
"""

from os import path
import pkg_resources

from sphinx.locale import _

import sphinx

try:
# Available from Sphinx 1.6
from sphinx.util.logging import getLogger
except ImportError:
from logging import getLogger


__version__ = '0.4.3.dev0'
__version_full__ = __version__


logger = getLogger(__name__)

def get_html_theme_path():
"""Return list of HTML theme paths."""
cur_dir = path.abspath(path.dirname(path.dirname(__file__)))
Expand All @@ -23,6 +34,14 @@ def get_html_theme_path():
def setup(app):
app.add_html_theme('sphinx_rtd_theme', path.abspath(path.dirname(__file__)))

# 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>.'))

if sphinx.version_info >= (1, 8, 0):
# Add Sphinx message catalog for newer versions of Sphinx
# See http://www.sphinx-doc.org/en/master/extdev/appapi.html#sphinx.application.Sphinx.add_message_catalog
Expand Down