Add hack for building docs on RTFD

This commit is contained in:
BJ Dierkes 2014-01-29 19:30:32 -06:00
parent f920e2a9c7
commit 469a7e02b2

View File

@ -21,6 +21,31 @@ app = test.TestApp()
RELEASE = version.get_version()
VERSION = '.'.join(RELEASE.split('.')[:2])
### Hack for Read The Docs:
import sys
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 = ['pylibmc']
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