55"""
66
77from 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
1011from sphinx .locale import _
1112from 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
3536def 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