17
17
18
18
from docutils .core import publish_parts
19
19
20
+
20
21
# If extensions (or modules to document with autodoc) are in another directory,
21
22
# add these directories to sys.path here. If the directory is relative to the
22
23
# documentation root, use os.path.abspath to make it absolute.
23
24
sys .path .insert (0 , os .path .abspath ('..' ))
24
25
sys .path .append (os .path .abspath ('.' ))
25
26
sys .path .append (os .path .abspath ('html' ))
26
27
28
+
29
+ # When ReaTheDocs.org builds your project, it sets the READTHEDOCS environment
30
+ # variable to the string True.
31
+ on_rtd = os .environ .get ('READTHEDOCS' , None ) == 'True'
32
+
33
+
27
34
def rst2html (input , output ):
28
35
"""
29
36
Create html file from rst file.
@@ -57,8 +64,9 @@ def rst2html(input, output):
57
64
extensions = ['sphinx.ext.intersphinx' , 'sphinx.ext.extlinks' ,
58
65
'sphinxcontrib.epydoc' ]
59
66
60
- # Paths that contain additional templates, relative to this directory.
61
- templates_path = ['html' ]
67
+ if on_rtd == False :
68
+ # Paths that contain additional templates, relative to this directory.
69
+ templates_path = ['html' ]
62
70
63
71
# The suffix of source filenames.
64
72
source_suffix = '.rst'
@@ -74,8 +82,12 @@ def rst2html(input, output):
74
82
project = 'PyAMF'
75
83
url = 'http://pyamf.org'
76
84
description = 'AMF for Python'
77
- copyright = "Copyright © 2007-%s The <a href='%s'>%s</a> Project. All rights reserved." % (
78
- time .strftime ('%Y' ), url , project )
85
+
86
+ if on_rtd == False :
87
+ copyright = "Copyright © 2007-%s The <a href='%s'>%s</a> Project. All rights reserved." % (
88
+ time .strftime ('%Y' ), url , project )
89
+ else :
90
+ copyright = "2007-%s The %s Project" % (time .strftime ('%Y' ), project )
79
91
80
92
# We look for the __init__.py file in the current PyAMF source tree
81
93
# and replace the values accordingly.
@@ -122,20 +134,30 @@ def rst2html(input, output):
122
134
123
135
# The theme to use for HTML and HTML Help pages. See the documentation for
124
136
# a list of builtin themes.
125
- #
126
- # Note: you can download the 'beam' theme from:
127
- # http://github.com/collab-project/sphinx-themes
128
- # and place it in a 'themes' directory relative to this config file.
129
- html_theme = 'beam'
137
+ if on_rtd :
138
+ # default theme for readthedocs.org
139
+ html_theme = 'default'
140
+ else :
141
+ # Note: you can download the 'beam' theme from:
142
+ # http://github.com/collab-project/sphinx-themes
143
+ # and place it in a 'themes' directory relative to this config file.
144
+ html_theme = 'beam'
145
+
146
+ # Custom themes here, relative to this directory.
147
+ html_theme_path = ['themes' ]
148
+
149
+ # Additional templates that should be rendered to pages, maps page names to
150
+ # template names.
151
+ html_additional_pages = {
152
+ 'index' : 'defindex.html' ,
153
+ 'tutorials/index' : 'tutorials.html' ,
154
+ }
130
155
131
156
# Theme options are theme-specific and customize the look and feel of a theme
132
157
# further. For a list of options available for each theme, see the
133
158
# documentation.
134
159
#html_theme_options = {}
135
160
136
- # Add any paths that contain custom themes here, relative to this directory.
137
- html_theme_path = ['themes' ]
138
-
139
161
# The name for this set of Sphinx documents. If None, it defaults to
140
162
# "<project> v<release> documentation".
141
163
html_title = '%s - %s' % (project , description )
@@ -156,13 +178,6 @@ def rst2html(input, output):
156
178
# typographically correct entities.
157
179
#html_use_smartypants = True
158
180
159
- # Additional templates that should be rendered to pages, maps page names to
160
- # template names.
161
- html_additional_pages = {
162
- 'index' : 'defindex.html' ,
163
- 'tutorials/index' : 'tutorials.html' ,
164
- }
165
-
166
181
# If false, no module index is generated.
167
182
html_use_modindex = True
168
183
0 commit comments