DOC use sphinx-rtd-theme even if built locally

This commit is contained in:
Patrick Kanzler 2016-03-08 17:21:27 +01:00
parent 1a2b8f1df2
commit 086b407b62
2 changed files with 14 additions and 3 deletions

View File

@ -14,6 +14,7 @@
import sys import sys
import os import os
on_rtd = os.getenv('READTHEDOCS') == 'True'
# If extensions (or modules to document with autodoc) are in another directory, # If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the # add these directories to sys.path here. If the directory is relative to the
@ -56,7 +57,7 @@ master_doc = 'index'
# General information about the project. # General information about the project.
project = u'python-escpos' project = u'python-escpos'
copyright = u'2015, Manuel F Martinez and others' copyright = u'2016, Manuel F Martinez and others'
# The version info for the project you're documenting, acts as replacement for # The version info for the project you're documenting, acts as replacement for
# |version| and |release|, also used in various other places throughout the # |version| and |release|, also used in various other places throughout the
@ -110,7 +111,16 @@ pygments_style = 'sphinx'
# The theme to use for HTML and HTML Help pages. See the documentation for # The theme to use for HTML and HTML Help pages. See the documentation for
# a list of builtin themes. # a list of builtin themes.
html_theme = 'default' if on_rtd:
html_theme = 'default'
else:
try:
import sphinx_rtd_theme
html_theme = 'sphinx_rtd_theme'
html_theme_path = [sphinx_rtd_theme.get_html_theme_path()]
except ImportError:
print("no sphinx_rtd_theme found, switching to nature")
html_theme = 'default'
# Theme options are theme-specific and customize the look and feel of a theme # Theme options are theme-specific and customize the look and feel of a theme
# further. For a list of options available for each theme, see the # further. For a list of options available for each theme, see the

View File

@ -1,4 +1,5 @@
pyusb pyusb
Pillow>=2.0 Pillow>=2.0
qrcode>=4.0 qrcode>=4.0
pyserial pyserial
sphinx-rtd-theme