From 667f8799587cdeb30c6959b8a285db52389d9f86 Mon Sep 17 00:00:00 2001
From: Martijn Vermaat <martijn@vermaat.name>
Date: Wed, 10 Dec 2014 21:18:26 +0100
Subject: [PATCH] Compilation of developer documentation on Read The Docs

We use a separate `doc/requirements.txt` file for building the
documentation. Since on Read The Docs where we cannot install
packages depending on C libraries, we mock these packages in
`doc/conf.py` and omit them from the requirements.
---
 README.rst           |  6 +++---
 doc/conf.py          | 12 ++++++++++++
 doc/requirements.txt | 12 ++++++++++++
 3 files changed, 27 insertions(+), 3 deletions(-)
 create mode 100644 doc/requirements.txt

diff --git a/README.rst b/README.rst
index d0b5742c..3c266c97 100644
--- a/README.rst
+++ b/README.rst
@@ -12,9 +12,9 @@ User documentation can be found on the `wiki
 <https://humgenprojects.lumc.nl/trac/mutalyzer>`_. From there, you can also
 submit bug reports and feature requests.
 
-Developer documentation can be found in the ``doc/`` subdirectory and can be
-compiled to HTML by running ``make html`` from there. This requires `Sphinx`_
-to be installed.
+Developer documentation is `hosted at Read The Docs
+<http://mutalyzer.readthedocs.org>`_. Contributions to Mutalyzer are welcome
+as `GitHub pull requests <https://github.com/LUMC/mutalyzer/pulls>`_.
 
 
 Copyright
diff --git a/doc/conf.py b/doc/conf.py
index 4dea1601..424e8512 100644
--- a/doc/conf.py
+++ b/doc/conf.py
@@ -15,6 +15,18 @@
 import sys
 import os
 
+# http://read-the-docs.readthedocs.org/en/latest/faq.html#i-get-import-errors-on-libraries-that-depend-on-c-modules
+from mock import MagicMock
+
+class Mock(MagicMock):
+    @classmethod
+    def __getattr__(cls, name):
+        return Mock()
+
+MOCK_MODULES = ['MySQLdb', 'cchardet', 'lxml', 'lxml.builder', 'lxml.etree',
+                'magic']
+sys.modules.update((mod_name, Mock()) for mod_name in MOCK_MODULES)
+
 # 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.
diff --git a/doc/requirements.txt b/doc/requirements.txt
new file mode 100644
index 00000000..e2f49324
--- /dev/null
+++ b/doc/requirements.txt
@@ -0,0 +1,12 @@
+Sphinx
+alembic
+biopython
+flask
+mock
+pyparsing
+redis
+sqlalchemy
+sphinx-rtd-theme
+spyne
+suds
+xlrd
-- 
GitLab