Skip to content

Commit

Permalink
Filter non-PACMAN modules from our documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
dkfellows committed Oct 25, 2019
1 parent 8a7a932 commit 4170d57
Showing 1 changed file with 20 additions and 1 deletion.
21 changes: 20 additions & 1 deletion doc/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@

# import sys
import os
import inspect
import six
from sphinx import apidoc

# If extensions (or modules to document with autodoc) are in another directory,
Expand All @@ -51,6 +53,8 @@
'sphinx.ext.intersphinx'
]

root_package = "pacman"

intersphinx_mapping = {'spinn_machine': (
'http://spinnmachine.readthedocs.org/en/latest/', None)}

Expand Down Expand Up @@ -354,9 +358,24 @@

autoclass_content = 'both'


def maybe_skip(app, what, name, obj, skip, options): # @UnusedVariable
# pylint: disable=unused-argument
if what == "module":
if isinstance(obj, six.class_types):
obj = inspect.getmodule(obj)
if inspect.ismodule(obj) and not obj.__name__.startswith(root_package):
skip = True
return skip


def setup(app):
app.connect('autodoc-skip-member', maybe_skip)


# Do the rst generation
for f in os.listdir("."):
if (os.path.isfile(f) and f.endswith(
".rst") and f != "index.rst" and f != "modules.rst"):
os.remove(f)
apidoc.main([None, '-o', ".", "../../pacman"])
apidoc.main([None, '-o', ".", "../../" + root_package])

0 comments on commit 4170d57

Please sign in to comment.