summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKali Kaneko <kali@leap.se>2013-09-25 10:13:23 -0400
committerKali Kaneko <kali@leap.se>2013-09-25 10:13:49 -0400
commitb575f5ffd94189b505a4fbedfe1b5196c3185a80 (patch)
treec183431545f10fd710d23c3d9bf5a0dd3b1dd9eb
parent5ba674d4397155092b8ebec217016d94e95e05e0 (diff)
mock clibs in sphinx build
Following the docs here: http://read-the-docs.readthedocs.org/en/latest/faq.html#i-get-import-errors-on-libraries-that-depend-on-c-modules
-rw-r--r--docs/conf.py28
1 files changed, 27 insertions, 1 deletions
diff --git a/docs/conf.py b/docs/conf.py
index 3c908b2c..3cfd0b5d 100644
--- a/docs/conf.py
+++ b/docs/conf.py
@@ -11,7 +11,33 @@
# All configuration values have a default; values that are commented out
# serve to show the default.
-import sys, os
+import sys
+import os
+
+
+class Mock(object):
+ def __init__(self, *args, **kwargs):
+ pass
+
+ def __call__(self, *args, **kwargs):
+ return Mock()
+
+ @classmethod
+ def __getattr__(cls, name):
+ if name in ('__file__', '__path__'):
+ return '/dev/null'
+ elif name[0] == name[0].upper():
+ mockType = type(name, (), {})
+ mockType.__module__ = __name__
+ return mockType
+ else:
+ return Mock()
+
+MOCK_MODULES = ['pysqlite', 'pyopenssl', 'pycryptopp', 'pysqlcipher']
+ #'google.protobuf'
+
+for mod_name in MOCK_MODULES:
+ sys.modules[mod_name] = 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