Commits

German Larrain committed f3a83be

doc: hacked conf.py to stop readthedocs errors with numpy, ode and vtk modules

  • Participants
  • Parent commits 564ca03

Comments (0)

Files changed (1)

docs/sphinx/source/conf.py

 
 # Allow duplicate toc entries.
 #epub_tocdup = True
+
+
+
+# -- ReadTheDocs tricks for missing libraries ----------------------------------
+
+# I get import errors on libraries that depend on C modules
+# http://read-the-docs.readthedocs.org/en/latest/faq.html#i-get-import-errors-on-libraries-that-depend-on-c-modules
+
+class Mock(object):
+    def __init__(self, *args, **kwargs):
+        pass
+
+    def __call__(self, *args, **kwargs):
+        return Mock()
+
+    @classmethod
+    def __getattr__(self, name):
+        if name in ('__file__', '__path__'):
+            return '/dev/null'
+        elif name[0] == name[0].upper():
+            return type(name, (), {})
+        else:
+            return Mock()
+
+MOCK_MODULES = ['numpy', 'ode', 'vtk', ]
+for mod_name in MOCK_MODULES:
+    sys.modules[mod_name] = Mock()
+