Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Added mock class to mock C modules for doc builds.

  • Loading branch information...
commit b0faa60be6bbe9bb212f9c2c56393f14d1743f89 1 parent e7a500c
@xzased authored
Showing with 21 additions and 0 deletions.
  1. +21 −0 docs/conf.py
View
21 docs/conf.py
@@ -187,6 +187,27 @@
u'Ruben Quinones', 'manual'),
]
+# Mock the existence of C modules (for readthedocs.org documentation builds).
+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 = ['libparted']
+for mod_name in MOCK_MODULES:
+ sys.modules[mod_name] = Mock()
+
# The name of an image file (relative to this directory) to place at the top of
# the title page.
#latex_logo = None
Please sign in to comment.
Something went wrong with that request. Please try again.