Show More
@@ -17,6 +17,33 b'' | |||||
17 |
|
17 | |||
18 | import sys, os |
|
18 | import sys, os | |
19 |
|
19 | |||
|
20 | ON_RTD = os.environ.get('READTHEDOCS', None) == 'True' | |||
|
21 | ||||
|
22 | if ON_RTD: | |||
|
23 | # Mock the presence of matplotlib, which we don't have on RTD | |||
|
24 | # see | |||
|
25 | # http://read-the-docs.readthedocs.org/en/latest/faq.html | |||
|
26 | ||||
|
27 | class Mock(object): | |||
|
28 | def __init__(self, *args, **kwargs): | |||
|
29 | pass | |||
|
30 | ||||
|
31 | def __call__(self, *args, **kwargs): | |||
|
32 | return Mock() | |||
|
33 | ||||
|
34 | @classmethod | |||
|
35 | def __getattr__(self, name): | |||
|
36 | if name in ('__file__', '__path__'): | |||
|
37 | return '/dev/null' | |||
|
38 | elif name[0] == name[0].upper(): | |||
|
39 | return type(name, (), {}) | |||
|
40 | else: | |||
|
41 | return Mock() | |||
|
42 | ||||
|
43 | MOCK_MODULES = ['matplotlib', 'matplotlib.sphinxext', 'numpy'] | |||
|
44 | for mod_name in MOCK_MODULES: | |||
|
45 | sys.modules[mod_name] = Mock() | |||
|
46 | ||||
20 | # If your extensions are in another directory, add it here. If the directory |
|
47 | # If your extensions are in another directory, add it here. If the directory | |
21 | # is relative to the documentation root, use os.path.abspath to make it |
|
48 | # is relative to the documentation root, use os.path.abspath to make it | |
22 | # absolute, like shown here. |
|
49 | # absolute, like shown here. | |
@@ -48,6 +75,11 b' extensions = [' | |||||
48 | 'github', # for easy GitHub links |
|
75 | 'github', # for easy GitHub links | |
49 | ] |
|
76 | ] | |
50 |
|
77 | |||
|
78 | if ON_RTD: | |||
|
79 | # Remove extensions not currently supported on RTD | |||
|
80 | extensions.remove('matplotlib.sphinxext.only_directives') | |||
|
81 | extensions.remove('ipython_directive') | |||
|
82 | ||||
51 | # Add any paths that contain templates here, relative to this directory. |
|
83 | # Add any paths that contain templates here, relative to this directory. | |
52 | templates_path = ['_templates'] |
|
84 | templates_path = ['_templates'] | |
53 |
|
85 |
General Comments 0
You need to be logged in to leave comments.
Login now