mirror of
https://git.deluge-torrent.org/deluge
synced 2025-08-09 09:58:39 +00:00
[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
4 changed files with 22 additions and 15 deletions
|
@ -18,6 +18,7 @@ from datetime import date
|
||||||
import pkg_resources
|
import pkg_resources
|
||||||
from recommonmark.states import DummyStateMachine
|
from recommonmark.states import DummyStateMachine
|
||||||
from recommonmark.transform import AutoStructify
|
from recommonmark.transform import AutoStructify
|
||||||
|
from sphinx.ext import apidoc
|
||||||
from sphinx.ext.autodoc import ClassDocumenter, bool_option
|
from sphinx.ext.autodoc import ClassDocumenter, bool_option
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
@ -297,7 +298,26 @@ def maybe_skip_member(app, what, name, obj, skip, options):
|
||||||
return True
|
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):
|
def setup(app):
|
||||||
|
app.connect('builder-inited', run_apidoc)
|
||||||
app.connect('autodoc-skip-member', maybe_skip_member)
|
app.connect('autodoc-skip-member', maybe_skip_member)
|
||||||
app.add_config_value('recommonmark_config', {}, True)
|
app.add_config_value('recommonmark_config', {}, True)
|
||||||
app.add_transform(AutoStructify)
|
app.add_transform(AutoStructify)
|
||||||
|
|
|
@ -9,4 +9,4 @@ setproctitle
|
||||||
pywin32; sys.platform == 'win32'
|
pywin32; sys.platform == 'win32'
|
||||||
py2-ipaddress; sys.platform == 'win32'
|
py2-ipaddress; sys.platform == 'win32'
|
||||||
certifi; 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)
|
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):
|
class CleanDocs(cmd.Command):
|
||||||
description = 'Clean the documentation build and module rst files'
|
description = 'Clean the documentation build and module rst files'
|
||||||
user_options = []
|
user_options = []
|
||||||
|
@ -454,7 +442,7 @@ cmdclass = {
|
||||||
'build_webui': BuildWebUI,
|
'build_webui': BuildWebUI,
|
||||||
'build_trans': BuildTranslations,
|
'build_trans': BuildTranslations,
|
||||||
'build_plugins': BuildPlugins,
|
'build_plugins': BuildPlugins,
|
||||||
'build_docs': BuildDocs,
|
'build_docs': BuildDoc,
|
||||||
'install_data': InstallData,
|
'install_data': InstallData,
|
||||||
'clean_plugins': CleanPlugins,
|
'clean_plugins': CleanPlugins,
|
||||||
'clean_trans': CleanTranslations,
|
'clean_trans': CleanTranslations,
|
||||||
|
|
1
tox.ini
1
tox.ini
|
@ -160,7 +160,6 @@ skip_install = True
|
||||||
deps = {[docsbase]deps}
|
deps = {[docsbase]deps}
|
||||||
commands =
|
commands =
|
||||||
python setup.py clean_docs
|
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
|
sphinx-build -v -j auto -E -T -b html -d docs/build/doctrees docs/source docs/build/html
|
||||||
|
|
||||||
[testenv:docscoverage]
|
[testenv:docscoverage]
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue