From de74356bbf559e4c98a3829c9c266ef76e7af813 Mon Sep 17 00:00:00 2001 From: Pieter Holtzhausen Date: Thu, 30 Jun 2011 16:14:46 +0200 Subject: [PATCH] Added destination to Makefile and fixed doc system --- doc/Makefile | 30 +++++++++++++++--------------- doc/ext/numpydoc.py | 11 +++++++++-- doc/tools/apigen.py | 5 +++-- 3 files changed, 27 insertions(+), 19 deletions(-) diff --git a/doc/Makefile b/doc/Makefile index c09f9168..55c952df 100644 --- a/doc/Makefile +++ b/doc/Makefile @@ -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." diff --git a/doc/ext/numpydoc.py b/doc/ext/numpydoc.py index 707107da..6667c429 100644 --- a/doc/ext/numpydoc.py +++ b/doc/ext/numpydoc.py @@ -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] diff --git a/doc/tools/apigen.py b/doc/tools/apigen.py index dc9a6eb7..5c86db8f 100644 --- a/doc/tools/apigen.py +++ b/doc/tools/apigen.py @@ -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 \