Skip to content

Commit 8237527

Browse files
committed
Print a warning when building docs with a pre-release version of the theme
1 parent feb0beb commit 8237527

File tree

3 files changed

+23
-0
lines changed

3 files changed

+23
-0
lines changed

babel.cfg

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,6 @@
88
encoding = utf-8
99
ignore_tags = script,style
1010
include_attrs = alt title summary placeholder
11+
12+
# Extraction from Python files
13+
[python: **.py]

docs/changelog.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ Other Changes
2020
* Added Spanish translation
2121
* Added i18n support using Babel
2222
* Moved build system from Grunt and friends to Webpack
23+
* Warn when using a pre-release version of the theme
2324

2425
0.4.3
2526
======

sphinx_rtd_theme/__init__.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,25 @@
55
"""
66

77
from os import path
8+
import pkg_resources
9+
10+
from sphinx.locale import _
811

912
import sphinx
1013

14+
try:
15+
# Available from Sphinx 1.6
16+
from sphinx.util.logging import getLogger
17+
except ImportError:
18+
from logging import getLogger
19+
1120

1221
__version__ = '0.4.3.dev0'
1322
__version_full__ = __version__
1423

1524

25+
logger = getLogger(__name__)
26+
1627
def get_html_theme_path():
1728
"""Return list of HTML theme paths."""
1829
cur_dir = path.abspath(path.dirname(path.dirname(__file__)))
@@ -23,6 +34,14 @@ def get_html_theme_path():
2334
def setup(app):
2435
app.add_html_theme('sphinx_rtd_theme', path.abspath(path.dirname(__file__)))
2536

37+
# Warn if a prerelease version of the theme is used
38+
39+
parsed_version = pkg_resources.parse_version(__version__)
40+
if parsed_version.is_prerelease:
41+
logger.warning(_('You are using a pre-release version (%s) of sphinx-rtd-theme.'), __version__)
42+
logger.warning(_('Use a stable release if you encounter problems.'))
43+
logger.warning(_('See <https://sphinx-rtd-theme.readthedocs.io/en/stable/installing.html>.'))
44+
2645
if sphinx.version_info >= (1, 8, 0):
2746
# Add Sphinx message catalog for newer versions of Sphinx
2847
# See http://www.sphinx-doc.org/en/master/extdev/appapi.html#sphinx.application.Sphinx.add_message_catalog

0 commit comments

Comments
 (0)