From 086b407b625ffc42428867c4d1edf2c7f641c0b2 Mon Sep 17 00:00:00 2001 From: Patrick Kanzler Date: Tue, 8 Mar 2016 17:21:27 +0100 Subject: [PATCH] DOC use sphinx-rtd-theme even if built locally --- doc/conf.py | 14 ++++++++++++-- doc/requirements.txt | 3 ++- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/doc/conf.py b/doc/conf.py index da6d7f0..9ecb8cf 100644 --- a/doc/conf.py +++ b/doc/conf.py @@ -14,6 +14,7 @@ import sys import os +on_rtd = os.getenv('READTHEDOCS') == 'True' # 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 @@ -56,7 +57,7 @@ master_doc = 'index' # General information about the project. 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 # |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 # 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 # further. For a list of options available for each theme, see the diff --git a/doc/requirements.txt b/doc/requirements.txt index 56c7e15..1cdf7f4 100644 --- a/doc/requirements.txt +++ b/doc/requirements.txt @@ -1,4 +1,5 @@ pyusb Pillow>=2.0 qrcode>=4.0 -pyserial \ No newline at end of file +pyserial +sphinx-rtd-theme \ No newline at end of file