diff --git a/docs/Makefile b/docs/Makefile index 9cf59fce..863e6f8d 100644 --- a/docs/Makefile +++ b/docs/Makefile @@ -6,7 +6,7 @@ SPHINXOPTS = SPHINXBUILD = sphinx-build SPHINXAPIDOC = sphinx-apidoc PAPER = -BUILDDIR = _build +BUILDDIR = . SOURCEDIR = ../src/ MODULE_NAMES = pylorax.rst modules.rst @@ -18,7 +18,7 @@ endif # Internal variables. PAPEROPT_a4 = -D latex_paper_size=a4 PAPEROPT_letter = -D latex_paper_size=letter -ALLSPHINXOPTS = -d $(BUILDDIR)/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) . +ALLSPHINXOPTS = $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) . # the i18n builder cannot share the environment and doctrees with the others I18NSPHINXOPTS = $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) . @@ -49,12 +49,11 @@ help: @echo " linkcheck to check all external links for integrity" @echo " doctest to run all doctests embedded in the documentation (if enabled)" -clean: - rm -rf $(BUILDDIR)/* - apidoc: - -rm $(addprefix ./, $(MODULE_NAMES)) - $(SPHINXAPIDOC) -o . $(SOURCEDIR) + if [ -f /usr/bin/$(SPHINXAPIDOC) ]; then \ + -rm $(addprefix ./, $(MODULE_NAMES)) + $(SPHINXAPIDOC) -o . $(SOURCEDIR) + fi html: $(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html diff --git a/docs/conf.py b/docs/conf.py index 41183d0b..a3ecc7fb 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -83,7 +83,7 @@ release = version # List of patterns, relative to source directory, that match files and # directories to ignore when looking for source files. -exclude_patterns = ['_build'] +exclude_patterns = ['_build', 'html'] # The reST default role (used for this markup: `text`) to use for all # documents. @@ -344,7 +344,17 @@ epub_exclude_files = ['search.html'] #epub_use_index = True # Example configuration for intersphinx: refer to the Python standard library. -intersphinx_mapping = {'https://docs.python.org/2': None} +intersphinx_mapping = {'https://docs.python.org/3': None} + +# on_rtd is whether we are on readthedocs.org +on_rtd = os.environ.get('READTHEDOCS', None) == 'True' + +if not on_rtd: # only import and set the theme if we're building docs locally + import sphinx_rtd_theme + html_theme = 'sphinx_rtd_theme' + html_theme_path = [sphinx_rtd_theme.get_html_theme_path()] + +# otherwise, readthedocs.org uses their theme by default, so no need to specify it # This was taken directly from here: # http://read-the-docs.readthedocs.org/en/latest/faq.html#i-get-import-errors-on-libraries-that-depend-on-c-modules