Skip to content

Commit 1de64f8

Browse files
committed
Add API docs refs #2, see also readthedocs/readthedocs.org#1139
1 parent 178a048 commit 1de64f8

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

docs/conf.py

+21
Original file line numberDiff line numberDiff line change
@@ -273,3 +273,24 @@
273273

274274
# If true, do not generate a @detailmenu in the "Top" node's menu.
275275
#texinfo_no_detailmenu = False
276+
277+
278+
import subprocess
279+
280+
281+
def run_apidoc(_):
282+
modules = ['a_list_of',
283+
'python_module_directories',
284+
'in_your_project']
285+
for module in modules:
286+
cur_dir = os.path.abspath(os.path.dirname(__file__))
287+
output_path = os.path.join(cur_dir, module, 'doc')
288+
cmd_path = 'sphinx-apidoc'
289+
if hasattr(sys, 'real_prefix'): # Check to see if we are in a virtualenv
290+
# If we are, assemble the path manually
291+
cmd_path = os.path.abspath(os.path.join(sys.prefix, 'bin', 'sphinx-apidoc'))
292+
subprocess.check_call([cmd_path, '-e', '-o', output_path, module, '--force'])
293+
294+
295+
def setup(app):
296+
app.connect('builder-inited', run_apidoc)

0 commit comments

Comments
 (0)