mirror of
https://github.com/readthedocs/sphinx_rtd_theme.git
synced 2025-02-25 18:55:21 -06:00
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 <santos_g@outlook.com> Co-authored-by: Santos Gallegos <santos_g@outlook.com>
This commit is contained in:
parent
6f684828ed
commit
3693d4c325
@ -5,8 +5,9 @@ From https://github.com/ryan-roemer/sphinx-bootstrap-theme.
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
from os import path
|
from os import path
|
||||||
|
from sys import version_info as python_version
|
||||||
|
|
||||||
from sphinx import version_info
|
from sphinx import version_info as sphinx_version
|
||||||
from sphinx.locale import _
|
from sphinx.locale import _
|
||||||
from sphinx.util.logging import getLogger
|
from sphinx.util.logging import getLogger
|
||||||
|
|
||||||
@ -33,8 +34,11 @@ def config_initiated(app, config):
|
|||||||
|
|
||||||
# See http://www.sphinx-doc.org/en/stable/theming.html#distribute-your-theme-as-a-python-package
|
# See http://www.sphinx-doc.org/en/stable/theming.html#distribute-your-theme-as-a-python-package
|
||||||
def setup(app):
|
def setup(app):
|
||||||
|
if python_version[0] < 3:
|
||||||
|
logger.warning("Python 2 is deprecated with sphinx_rtd_theme, update to Python 3")
|
||||||
app.require_sphinx('1.6')
|
app.require_sphinx('1.6')
|
||||||
if version_info <= (2, 0, 0):
|
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:
|
if not app.config.html_experimental_html5_writer:
|
||||||
logger.warning("'html4_writer' is deprecated with sphinx_rtd_theme")
|
logger.warning("'html4_writer' is deprecated with sphinx_rtd_theme")
|
||||||
else:
|
else:
|
||||||
@ -44,7 +48,7 @@ def setup(app):
|
|||||||
# Register the theme that can be referenced without adding a theme path
|
# Register the theme that can be referenced without adding a theme path
|
||||||
app.add_html_theme('sphinx_rtd_theme', path.abspath(path.dirname(__file__)))
|
app.add_html_theme('sphinx_rtd_theme', path.abspath(path.dirname(__file__)))
|
||||||
|
|
||||||
if version_info >= (1, 8, 0):
|
if sphinx_version >= (1, 8, 0):
|
||||||
# Add Sphinx message catalog for newer versions of Sphinx
|
# 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
|
# See http://www.sphinx-doc.org/en/master/extdev/appapi.html#sphinx.application.Sphinx.add_message_catalog
|
||||||
rtd_locale_path = path.join(path.abspath(path.dirname(__file__)), 'locale')
|
rtd_locale_path = path.join(path.abspath(path.dirname(__file__)), 'locale')
|
||||||
|
Loading…
Reference in New Issue
Block a user