Skip to content

Commit

Permalink
Include mock modules for documentation.
Browse files Browse the repository at this point in the history
  • Loading branch information
Christoph Paulik committed Feb 4, 2016
1 parent 7e4944e commit ea6d6e1
Showing 1 changed file with 23 additions and 14 deletions.
37 changes: 23 additions & 14 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,20 @@
# documentation root, use os.path.abspath to make it absolute, like shown here.
# sys.path.insert(0, os.path.abspath('.'))

# -- Hack for ReadTheDocs ------------------------------------------------------
# -- Hack for ReadTheDocs ------------------------------------------------
# This hack is necessary since RTD does not issue `sphinx-apidoc` before running
# `sphinx-build -b html . _build/html`. See Issue:
# https://github.com/rtfd/readthedocs.org/issues/1139
# DON'T FORGET: Check the box "Install your project inside a virtualenv using
# setup.py install" in the RTD Advanced Settings.

import mock

MOCK_MODULES = ['numpy', 'numpy.testing', 'pykdtree', 'netCDF4',
'pyproj']
for mod_name in MOCK_MODULES:
sys.modules[mod_name] = mock.Mock()

import os
on_rtd = os.environ.get('READTHEDOCS', None) == 'True'
if on_rtd:
Expand All @@ -33,10 +41,11 @@
output_dir = os.path.join(__location__, "../docs/api")
module_dir = os.path.join(__location__, "../pygeogrids")
cmd_line_template = "sphinx-apidoc -f -o {outputdir} {moduledir}"
cmd_line = cmd_line_template.format(outputdir=output_dir, moduledir=module_dir)
cmd_line = cmd_line_template.format(
outputdir=output_dir, moduledir=module_dir)
apidoc.main(cmd_line.split(" "))

# -- General configuration -----------------------------------------------------
# -- General configuration -----------------------------------------------

# If your documentation needs a minimal Sphinx version, state it here.
# needs_sphinx = '1.0'
Expand Down Expand Up @@ -111,7 +120,7 @@
# keep_warnings = False


# -- Options for HTML output ---------------------------------------------------
# -- Options for HTML output ---------------------------------------------

# The theme to use for HTML and HTML Help pages. See the documentation for
# a list of builtin themes.
Expand Down Expand Up @@ -196,24 +205,24 @@
htmlhelp_basename = 'pygeogrids-doc'


# -- Options for LaTeX output --------------------------------------------------
# -- Options for LaTeX output --------------------------------------------

latex_elements = {
# The paper size ('letterpaper' or 'a4paper').
# 'papersize': 'letterpaper',
# The paper size ('letterpaper' or 'a4paper').
# 'papersize': 'letterpaper',

# The font size ('10pt', '11pt' or '12pt').
# 'pointsize': '10pt',
# The font size ('10pt', '11pt' or '12pt').
# 'pointsize': '10pt',

# Additional stuff for the LaTeX preamble.
# 'preamble': '',
# Additional stuff for the LaTeX preamble.
# 'preamble': '',
}

# Grouping the document tree into LaTeX files. List of tuples
# (source start file, target name, title, author, documentclass [howto/manual]).
latex_documents = [
('index', 'user_guide.tex', u'pygeogrids Documentation',
u'Christoph Paulik', 'manual'),
('index', 'user_guide.tex', u'pygeogrids Documentation',
u'Christoph Paulik', 'manual'),
]

# The name of an image file (relative to this directory) to place at the top of
Expand All @@ -236,7 +245,7 @@
# If false, no module index is generated.
# latex_domain_indices = True

# -- External mapping ------------------------------------------------------------
# -- External mapping ----------------------------------------------------
python_version = '.'.join(map(str, sys.version_info[0:2]))
intersphinx_mapping = {
'sphinx': ('http://sphinx.pocoo.org', None),
Expand Down

0 comments on commit ea6d6e1

Please sign in to comment.