[ckan-changes] [okfn/ckan] 20a68e: [docs] Mock pyutilib in doc/conf.py
GitHub
noreply at github.com
Wed May 2 15:10:34 UTC 2012
Branch: refs/heads/master
Home: https://github.com/okfn/ckan
Commit: 20a68e64e590165603b51417d5eb82810d4689aa
https://github.com/okfn/ckan/commit/20a68e64e590165603b51417d5eb82810d4689aa
Author: Sean Hammond <seanhammond at lavabit.com>
Date: 2012-05-02 (Wed, 02 May 2012)
Changed paths:
M doc/conf.py
Log Message:
-----------
[docs] Mock pyutilib in doc/conf.py
I'm hoping that this will fix autodoc on readthedocs.org
diff --git a/doc/conf.py b/doc/conf.py
index 3b672db..0de4e6f 100644
--- a/doc/conf.py
+++ b/doc/conf.py
@@ -16,6 +16,28 @@
import sys, os
+# Importing pyutilib doesn't seem to work on readthedocs.org and this breaks
+# autodoc, so mock pyutilib here.
+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 = ['pyutilib', 'pyutilib.component', 'pyutilib.component.core',]
+for mod_name in MOCK_MODULES:
+ sys.modules[mod_name] = Mock()
+
# If your extensions (or modules documented by 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.
================================================================
More information about the ckan-changes
mailing list