[Docs] Move apidoc command to Sphinx config

The apidoc modules were not being generated on ReadTheDocs because
there is no way to run sphinx-apidoc manually.

Moved the running of sphinx-apidoc into conf.py.

Added zope.interface minimum version to fix Readthedocs warning.
This commit is contained in:
Calum Lind 2018-11-02 00:09:53 +00:00
parent 20431cc771
commit 98051bdea2
4 changed files with 22 additions and 15 deletions

View File

@ -18,6 +18,7 @@ from datetime import date
import pkg_resources
from recommonmark.states import DummyStateMachine
from recommonmark.transform import AutoStructify
from sphinx.ext import apidoc
from sphinx.ext.autodoc import ClassDocumenter, bool_option
try:
@ -297,7 +298,26 @@ def maybe_skip_member(app, what, name, obj, skip, options):
return True
# Run the sphinx-apidoc to create package/modules rst files for autodoc.
def run_apidoc(__):
cur_dir = os.path.abspath(os.path.dirname(__file__))
module_dir = os.path.join(cur_dir, '..', '..', 'deluge')
ignore_paths = [
os.path.join(module_dir, 'plugins'),
os.path.join(module_dir, 'tests'),
]
argv = [
'--force',
'--no-toc',
'--output-dir',
os.path.join(cur_dir, 'modules'),
module_dir,
] + ignore_paths
apidoc.main(argv)
def setup(app):
app.connect('builder-inited', run_apidoc)
app.connect('autodoc-skip-member', maybe_skip_member)
app.add_config_value('recommonmark_config', {}, True)
app.add_transform(AutoStructify)

View File

@ -9,4 +9,4 @@ setproctitle
pywin32; sys.platform == 'win32'
py2-ipaddress; sys.platform == 'win32'
certifi; sys.platform == 'win32'
zope.interface
zope.interface>=4.4.2

View File

@ -72,18 +72,6 @@ class PyTest(_test):
sys.exit(errcode)
class BuildDocs(BuildDoc):
description = 'Build the documentation'
def run(self):
print('Generating module documentation...')
os.system(
'sphinx-apidoc --force --no-toc'
' -o docs/source/modules/ deluge deluge/plugins'
)
BuildDoc.run(self)
class CleanDocs(cmd.Command):
description = 'Clean the documentation build and module rst files'
user_options = []
@ -454,7 +442,7 @@ cmdclass = {
'build_webui': BuildWebUI,
'build_trans': BuildTranslations,
'build_plugins': BuildPlugins,
'build_docs': BuildDocs,
'build_docs': BuildDoc,
'install_data': InstallData,
'clean_plugins': CleanPlugins,
'clean_trans': CleanTranslations,

View File

@ -160,7 +160,6 @@ skip_install = True
deps = {[docsbase]deps}
commands =
python setup.py clean_docs
sphinx-apidoc --force --no-toc -o docs/source/modules/ deluge deluge/plugins
sphinx-build -v -j auto -E -T -b html -d docs/build/doctrees docs/source docs/build/html
[testenv:docscoverage]