From 50c14db17aa44322d8548a01cab9edbe8a2a2e4f Mon Sep 17 00:00:00 2001 From: Robert Jordens Date: Thu, 5 Feb 2015 04:31:35 -0700 Subject: [PATCH] doc/manual: mock up external modules for sphinx-autodoc --- .travis.yml | 2 +- doc/manual/conf.py | 15 +++++++++++++++ 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index b2c6feb7a..4c8bab708 100644 --- a/.travis.yml +++ b/.travis.yml @@ -25,7 +25,7 @@ install: - pip install -e . script: - coverage run --source=artiq setup.py test - - make -C doc/manual html || true + - make -C doc/manual html - cd misoc; python make.py -X ../soc -t artiq build-headers build-bios; cd .. - make -C soc/runtime - cd misoc; python make.py -X ../soc -t artiq build-bitstream; cd .. diff --git a/doc/manual/conf.py b/doc/manual/conf.py index 02a3adf23..0d8e0a5d8 100644 --- a/doc/manual/conf.py +++ b/doc/manual/conf.py @@ -16,6 +16,21 @@ import sys import os +from unittest.mock import MagicMock + + +class Mock(MagicMock): + @classmethod + def __getattr__(cls, name): + return Mock() + + +mock_modules = ["gbulb", "gi", "gi.repository", "cairoplot", "matplotlib"] + +for module in mock_modules: + sys.modules[module] = Mock() + + # 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.