summaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
authorPatrick Totzke <patricktotzke@gmail.com>2018-11-11 11:21:45 +0000
committerPatrick Totzke <patricktotzke@gmail.com>2018-11-11 11:21:45 +0000
commita9e04e1467b4e6ef84030967463d0bda8ba89ba2 (patch)
tree6e1f93d89321641ef46b963e7bcd05833dc27910 /docs
parent8d03db4dd3d0aeea866c4eeb47080b82fed9a009 (diff)
docs: use sphinx's autodoc_mock_imports to mock
.. out stuff whne building the docs instead of using homebrew methods. http://www.sphinx-doc.org/en/master/usage/extensions/autodoc.html#confval-autodoc_mock_imports
Diffstat (limited to 'docs')
-rw-r--r--docs/source/conf.py50
1 files changed, 11 insertions, 39 deletions
diff --git a/docs/source/conf.py b/docs/source/conf.py
index d86ae419..76467330 100644
--- a/docs/source/conf.py
+++ b/docs/source/conf.py
@@ -2,44 +2,6 @@
# alot documentation build configuration file
import sys, os
-###############################
-# readthedocs.org hack,
-# needed to use autodocs on their build-servers:
-# http://readthedocs.org/docs/read-the-docs/en/latest/faq.html?highlight=autodocs#where-do-i-need-to-put-my-docs-for-rtd-to-find-it
-
-class Mock(object):
- def __init__(self, *args, **kwargs):
- pass
-
- def __call__(self, *args, **kwargs):
- return Mock()
-
- @classmethod
- def __getattr__(cls, name):
- return Mock() if name not in ('__file__', '__path__') else '/dev/null'
-
-class MockModule(object):
- @classmethod
- def __getattr__(cls, name):
- return Mock if name not in ('__file__', '__path__') else '/dev/null'
-
-MOCK_MODULES = ['urwid',
- 'urwidtrees',
- 'magic',
- 'gpg',
- 'configobj',
- 'validate',
- 'argparse',
- 'alot.settings.const']
-MOCK_DIRTY = ['notmuch']
-for mod_name in MOCK_MODULES:
- sys.modules[mod_name] = MockModule()
-for mod_name in MOCK_DIRTY:
- sys.modules[mod_name] = Mock()
-
-# end of readthedocs.org hack
-##############################
-
# 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
# documentation root, use os.path.abspath to make it absolute, like shown here.
@@ -56,7 +18,17 @@ from alot import __version__,__author__
extensions = ['sphinx.ext.autodoc', 'sphinx.ext.intersphinx']
# autodoc tweaks
-
+autodoc_mock_imports = [
+ 'alot.settings.const',
+ 'argparse',
+ 'configobj',
+ 'gpg',
+ 'magic',
+ 'notmuch',
+ 'urwid',
+ 'urwidtrees',
+ 'validate',
+]
# show classes' docstrings _and_ constructors docstrings/parameters
autoclass_content = 'both'