Added destination to Makefile and fixed doc system

This commit is contained in:
Pieter Holtzhausen
2011-06-30 16:14:46 +02:00
parent b8149aca1b
commit de74356bbf
3 changed files with 27 additions and 19 deletions
+15 -15
View File
@@ -10,7 +10,7 @@ PAPER =
PAPEROPT_a4 = -D latex_paper_size=a4
PAPEROPT_letter = -D latex_paper_size=letter
ALLSPHINXOPTS = -d build/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) source
DEST = build
.PHONY: help clean html dirhtml pickle json htmlhelp qthelp latex changes linkcheck doctest
help:
@@ -29,7 +29,7 @@ help:
@echo " doctest to run all doctests embedded in the documentation (if enabled)"
clean:
-rm -rf build/*
-rm -rf $(DEST)/*
api:
mkdir -p source/api
@@ -37,33 +37,33 @@ api:
@echo "Build API docs finished."
html: api
$(SPHINXBUILD) -b html $(ALLSPHINXOPTS) build/html
$(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(DEST)/html
@echo
@echo "Build finished. The HTML pages are in build/html."
dirhtml:
$(SPHINXBUILD) -b dirhtml $(ALLSPHINXOPTS) build/dirhtml
$(SPHINXBUILD) -b dirhtml $(ALLSPHINXOPTS) $(DEST)/dirhtml
@echo
@echo "Build finished. The HTML pages are in build/dirhtml."
pickle:
$(SPHINXBUILD) -b pickle $(ALLSPHINXOPTS) build/pickle
$(SPHINXBUILD) -b pickle $(ALLSPHINXOPTS) $(DEST)/pickle
@echo
@echo "Build finished; now you can process the pickle files."
json:
$(SPHINXBUILD) -b json $(ALLSPHINXOPTS) build/json
$(SPHINXBUILD) -b json $(ALLSPHINXOPTS) $(DEST)/json
@echo
@echo "Build finished; now you can process the JSON files."
htmlhelp:
$(SPHINXBUILD) -b htmlhelp $(ALLSPHINXOPTS) build/htmlhelp
$(SPHINXBUILD) -b htmlhelp $(ALLSPHINXOPTS) $(DEST)/htmlhelp
@echo
@echo "Build finished; now you can run HTML Help Workshop with the" \
".hhp project file in build/htmlhelp."
qthelp:
$(SPHINXBUILD) -b qthelp $(ALLSPHINXOPTS) build/qthelp
$(SPHINXBUILD) -b qthelp $(ALLSPHINXOPTS) $(DEST)/qthelp
@echo
@echo "Build finished; now you can run "qcollectiongenerator" with the" \
".qhcp project file in build/qthelp, like this:"
@@ -72,7 +72,7 @@ qthelp:
@echo "# assistant -collectionFile build/qthelp/scikitsimage.qhc"
devhelp:
$(SPHINXBUILD) -b devhelp $(ALLSPHINXOPTS) build/devhelp
$(SPHINXBUILD) -b devhelp $(ALLSPHINXOPTS) $(DEST)/devhelp
@echo
@echo "Build finished."
@echo "To view the help file:"
@@ -81,30 +81,30 @@ devhelp:
@echo "# devhelp"
latex:
$(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) build/latex
$(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(DEST)/latex
@echo
@echo "Build finished; the LaTeX files are in build/latex."
@echo "Build finished; the LaTeX files are in $(DEST)/latex."
@echo "Run \`make all-pdf' or \`make all-ps' in that directory to" \
"run these through (pdf)latex."
latexpdf: latex
$(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) build/latex
$(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(DEST)/latex
@echo "Running LaTeX files through pdflatex..."
make -C build/latex all-pdf
@echo "pdflatex finished; the PDF files are in build/latex."
changes:
$(SPHINXBUILD) -b changes $(ALLSPHINXOPTS) build/changes
$(SPHINXBUILD) -b changes $(ALLSPHINXOPTS) $(DEST)/changes
@echo
@echo "The overview file is in build/changes."
linkcheck:
$(SPHINXBUILD) -b linkcheck $(ALLSPHINXOPTS) build/linkcheck
$(SPHINXBUILD) -b linkcheck $(ALLSPHINXOPTS) $(DEST)/linkcheck
@echo
@echo "Link check complete; look for any errors in the above output " \
"or in build/linkcheck/output.txt."
doctest:
$(SPHINXBUILD) -b doctest $(ALLSPHINXOPTS) build/doctest
$(SPHINXBUILD) -b doctest $(ALLSPHINXOPTS) $(DEST)/doctest
@echo "Testing of doctests in the sources finished, look at the " \
"results in build/doctest/output.txt."
+9 -2
View File
@@ -124,8 +124,15 @@ def get_directive(name):
from docutils.parsers.rst import directives
try:
return directives.directive(name, None, None)[0]
except AttributeError:
pass
except AttributeError:
if "method" in name:
name = "automethod"
else:
name = "auto"+name
try:
return directives.directive(name, None, None)[0]
except AttributeError:
pass
try:
# docutils 0.4
return directives._directives[name]
+3 -2
View File
@@ -194,14 +194,15 @@ class ApiDocWriter(object):
classes : list of str
A list of (public) class names in the module.
"""
exec 'import ' + uri
exec 'mod = ' + uri
mod = __import__(uri, fromlist=[uri])
# find all public objects in the module.
obj_strs = [obj for obj in dir(mod) if not obj.startswith('_')]
functions = []
classes = []
for obj_str in obj_strs:
# find the actual object from its string representation
if obj_str not in mod.__dict__:
continue
obj = mod.__dict__[obj_str]
# figure out if obj is a function or class
if hasattr(obj, 'func_name') or \