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 | tags.add('rtd') | |||
|
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 |
@@ -1,7 +1,7 b'' | |||||
1 | .. _ipython_directive: |
|
1 | .. _ipython_directive: | |
2 |
|
2 | |||
3 | ======================== |
|
3 | ======================== | |
4 |
I |
|
4 | IPython Sphinx Directive | |
5 | ======================== |
|
5 | ======================== | |
6 |
|
6 | |||
7 | The ipython directive is a stateful ipython shell for embedding in |
|
7 | The ipython directive is a stateful ipython shell for embedding in |
@@ -7,7 +7,13 b' IPython Documentation' | |||||
7 | :Release: |release| |
|
7 | :Release: |release| | |
8 | :Date: |today| |
|
8 | :Date: |today| | |
9 |
|
9 | |||
10 | Welcome to the official IPython documentation. |
|
10 | .. only:: not rtd | |
|
11 | ||||
|
12 | Welcome to the official IPython documentation. | |||
|
13 | ||||
|
14 | .. only:: rtd | |||
|
15 | ||||
|
16 | This is a partial copy of IPython documentation, please visit `IPython official documentation <http://ipython.org/documentation.html>`_. | |||
11 |
|
17 | |||
12 | Contents |
|
18 | Contents | |
13 | ======== |
|
19 | ======== |
General Comments 0
You need to be logged in to leave comments.
Login now