[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:
parent
20431cc771
commit
98051bdea2
|
@ -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)
|
||||
|
|
|
@ -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
|
||||
|
|
14
setup.py
14
setup.py
|
@ -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,
|
||||
|
|
1
tox.ini
1
tox.ini
|
@ -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]
|
||||
|
|
Loading…
Reference in New Issue