Skip to content

Commit 3693d4c

Browse files
Blendifystsewd
andauthored
Add deprecation warning for dropping Sphinx 2 and Python 2 support (#1099)
* Add deprecation warning for dropping Sphinx 2 and Python 2 support Fixes #1092 * Cleanup version imports * Update __init__.py * Update sphinx_rtd_theme/__init__.py Co-authored-by: Santos Gallegos <[email protected]> Co-authored-by: Santos Gallegos <[email protected]>
1 parent 6f68482 commit 3693d4c

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

sphinx_rtd_theme/__init__.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,9 @@
55
"""
66

77
from os import path
8+
from sys import version_info as python_version
89

9-
from sphinx import version_info
10+
from sphinx import version_info as sphinx_version
1011
from sphinx.locale import _
1112
from sphinx.util.logging import getLogger
1213

@@ -33,8 +34,11 @@ def config_initiated(app, config):
3334

3435
# See http://www.sphinx-doc.org/en/stable/theming.html#distribute-your-theme-as-a-python-package
3536
def setup(app):
37+
if python_version[0] < 3:
38+
logger.warning("Python 2 is deprecated with sphinx_rtd_theme, update to Python 3")
3639
app.require_sphinx('1.6')
37-
if version_info <= (2, 0, 0):
40+
if sphinx_version <= (2, 0, 0):
41+
logger.warning("Sphinx 1.x is deprecated with sphinx_rtd_theme, update to Sphinx 2.x or greater")
3842
if not app.config.html_experimental_html5_writer:
3943
logger.warning("'html4_writer' is deprecated with sphinx_rtd_theme")
4044
else:
@@ -44,7 +48,7 @@ def setup(app):
4448
# Register the theme that can be referenced without adding a theme path
4549
app.add_html_theme('sphinx_rtd_theme', path.abspath(path.dirname(__file__)))
4650

47-
if version_info >= (1, 8, 0):
51+
if sphinx_version >= (1, 8, 0):
4852
# Add Sphinx message catalog for newer versions of Sphinx
4953
# See http://www.sphinx-doc.org/en/master/extdev/appapi.html#sphinx.application.Sphinx.add_message_catalog
5054
rtd_locale_path = path.join(path.abspath(path.dirname(__file__)), 'locale')

0 commit comments

Comments
 (0)