From 469a7e02b2d4a498ac65704e834e14bd344917cb Mon Sep 17 00:00:00 2001 From: BJ Dierkes Date: Wed, 29 Jan 2014 19:30:32 -0600 Subject: [PATCH] Add hack for building docs on RTFD --- doc/source/conf.py | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/doc/source/conf.py b/doc/source/conf.py index 27fa56fe..94def1d7 100644 --- a/doc/source/conf.py +++ b/doc/source/conf.py @@ -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