Browse Source

Generate API docs in sphinx.

Jelmer Vernooij 6 years ago
parent
commit
8706eed1fc
5 changed files with 34 additions and 16 deletions
  1. 0 5
      Makefile
  2. 11 8
      docs/Makefile
  3. 14 0
      docs/api/index.txt
  4. 7 2
      docs/conf.py
  5. 2 1
      docs/index.txt

+ 0 - 5
Makefile

@@ -3,7 +3,6 @@ PYFLAKES = pyflakes
 PEP8 = pep8
 FLAKE8 ?= flake8
 SETUP = $(PYTHON) setup.py
-PYDOCTOR ?= pydoctor
 TESTRUNNER ?= unittest
 RUNTEST = PYTHONHASHSEED=random PYTHONPATH=$(shell pwd)$(if $(PYTHONPATH),:$(PYTHONPATH),) $(PYTHON) -m $(TESTRUNNER) $(TEST_OPTIONS)
 COVERAGE = python3-coverage
@@ -12,15 +11,11 @@ DESTDIR=/
 
 all: build
 
-doc:: pydoctor
 doc:: sphinx
 
 sphinx::
 	$(MAKE) -C docs html
 
-pydoctor::
-	$(PYDOCTOR) --make-html -c dulwich.cfg
-
 build::
 	$(SETUP) build
 	$(SETUP) build_ext -i

+ 11 - 8
docs/Makefile

@@ -31,33 +31,36 @@ help:
 clean:
 	-rm -rf $(BUILDDIR)/*
 
-html:
+apidocs:
+	sphinx-apidoc -feM -s txt -o api ../dulwich
+
+html: apidocs
 	$(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html
 	@echo
 	@echo "Build finished. The HTML pages are in $(BUILDDIR)/html."
 
-dirhtml:
+dirhtml: apidocs
 	$(SPHINXBUILD) -b dirhtml $(ALLSPHINXOPTS) $(BUILDDIR)/dirhtml
 	@echo
 	@echo "Build finished. The HTML pages are in $(BUILDDIR)/dirhtml."
 
-pickle:
+pickle: apidocs
 	$(SPHINXBUILD) -b pickle $(ALLSPHINXOPTS) $(BUILDDIR)/pickle
 	@echo
 	@echo "Build finished; now you can process the pickle files."
 
-json:
+json: apidocs
 	$(SPHINXBUILD) -b json $(ALLSPHINXOPTS) $(BUILDDIR)/json
 	@echo
 	@echo "Build finished; now you can process the JSON files."
 
-htmlhelp:
+htmlhelp: apidocs
 	$(SPHINXBUILD) -b htmlhelp $(ALLSPHINXOPTS) $(BUILDDIR)/htmlhelp
 	@echo
 	@echo "Build finished; now you can run HTML Help Workshop with the" \
 	      ".hhp project file in $(BUILDDIR)/htmlhelp."
 
-qthelp:
+qthelp: apidocs
 	$(SPHINXBUILD) -b qthelp $(ALLSPHINXOPTS) $(BUILDDIR)/qthelp
 	@echo
 	@echo "Build finished; now you can run "qcollectiongenerator" with the" \
@@ -66,14 +69,14 @@ qthelp:
 	@echo "To view the help file:"
 	@echo "# assistant -collectionFile $(BUILDDIR)/qthelp/dulwich.qhc"
 
-latex:
+latex: apidocs
 	$(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
 	@echo
 	@echo "Build finished; the LaTeX files are in $(BUILDDIR)/latex."
 	@echo "Run \`make all-pdf' or \`make all-ps' in that directory to" \
 	      "run these through (pdf)latex."
 
-changes:
+changes: apidocs
 	$(SPHINXBUILD) -b changes $(ALLSPHINXOPTS) $(BUILDDIR)/changes
 	@echo
 	@echo "The overview file is in $(BUILDDIR)/changes."

+ 14 - 0
docs/api/index.txt

@@ -0,0 +1,14 @@
+This is the API documentation for Dulwich.
+
+Module reference
+----------------
+
+.. toctree::
+    :maxdepth: 3
+
+    modules
+
+Indices:
+
+* :ref:`modindex`
+* :ref:`search`

+ 7 - 2
docs/conf.py

@@ -26,7 +26,12 @@ dulwich = __import__('dulwich')
 
 # Add any Sphinx extension module names here, as strings. They can be
 # extensions coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
-extensions = ['sphinx.ext.autodoc']
+extensions = [
+    'sphinx.ext.autodoc',
+    'sphinx.ext.ifconfig',
+    'sphinx.ext.intersphinx',
+    'sphinx_epytext',
+    ]
 try:
     import rst2pdf
     if rst2pdf.version >= '0.16':
@@ -51,7 +56,7 @@ master_doc = 'index'
 
 # General information about the project.
 project = u'dulwich'
-copyright = u'2011, Jelmer Vernooij'
+copyright = u'2011-2018 Jelmer Vernooij'
 
 # The version info for the project you're documenting, acts as replacement for
 # |version| and |release|, also used in various other places throughout the

+ 2 - 1
docs/index.txt

@@ -12,7 +12,6 @@ Overview
 Documentation
 =============
 
-
 .. toctree::
     :maxdepth: 2
 
@@ -21,6 +20,8 @@ Documentation
 
     tutorial/index
 
+    api/index
+
 
 Changelog
 =========