From 29a4e902aa42404a05b8361adf289e54f0fe8875 Mon Sep 17 00:00:00 2001 From: Nguyen Hai Date: Tue, 4 Sep 2018 16:47:46 +0900 Subject: [PATCH] Fix openstack-tox-docs failure Change-Id: I01035d5cb04b5908571d1d5e177176e9d8f24091 --- doc/requirements.txt | 11 +++++++++++ doc/source/conf.py | 9 ++++++++- doc/source/reference/index.rst | 2 +- freezer/scheduler/freezer_scheduler.py | 4 ++-- setup.cfg | 12 ------------ test-requirements.txt | 3 --- tox.ini | 10 +++++++--- 7 files changed, 29 insertions(+), 22 deletions(-) create mode 100644 doc/requirements.txt diff --git a/doc/requirements.txt b/doc/requirements.txt new file mode 100644 index 00000000..3dc6a0f6 --- /dev/null +++ b/doc/requirements.txt @@ -0,0 +1,11 @@ +# The order of packages is significant, because pip processes them in the order +# of appearance. Changing the order has an impact on the overall integration +# process, which may cause wedges in the gate later. +sphinx!=1.6.6,!=1.6.7,>=1.6.2 # BSD +sphinxcontrib-apidoc>=0.2.0 # BSD +openstackdocstheme>=1.18.1 # Apache-2.0 +reno>=2.5.0 # Apache-2.0 +mock>=2.0.0 # BSD +ddt>=1.0.1 # MIT +testtools>=2.2.0 # MIT +tempest>=17.1.0 # Apache-2.0 diff --git a/doc/source/conf.py b/doc/source/conf.py index 78b61d2c..bb66bc99 100644 --- a/doc/source/conf.py +++ b/doc/source/conf.py @@ -39,7 +39,7 @@ import sys # They can be extensions coming with Sphinx (named 'sphinx.ext.*') # or your custom ones. -extensions = ['sphinx.ext.autodoc', +extensions = ['sphinxcontrib.apidoc', 'openstackdocstheme', 'oslo_config.sphinxconfiggen', 'oslo_config.sphinxext' @@ -57,6 +57,13 @@ sample_config_basename = '_static/freezer' todo_include_todos = True +# sphinxcontrib.apidoc options +apidoc_module_dir = '../../freezer' +apidoc_output_dir = 'reference/api' +apidoc_excluded_paths = [ + 'scheduler/win*'] +apidoc_separate_modules = True + # Add any paths that contain templates here, relative to this directory. # templates_path = [] diff --git a/doc/source/reference/index.rst b/doc/source/reference/index.rst index e1fe0447..fb305120 100644 --- a/doc/source/reference/index.rst +++ b/doc/source/reference/index.rst @@ -4,4 +4,4 @@ Reference .. toctree:: :maxdepth: 2 - api/autoindex + api/modules diff --git a/freezer/scheduler/freezer_scheduler.py b/freezer/scheduler/freezer_scheduler.py index ddf18a05..e567dcc2 100644 --- a/freezer/scheduler/freezer_scheduler.py +++ b/freezer/scheduler/freezer_scheduler.py @@ -32,9 +32,9 @@ from freezer.utils import utils as freezer_utils from freezer.utils import winutils if winutils.is_windows(): - import win_daemon + from freezer.scheduler import win_daemon else: - import daemon as linux_daemon + from freezer.scheduler import daemon as linux_daemon CONF = cfg.CONF LOG = log.getLogger(__name__) diff --git a/setup.cfg b/setup.cfg index 6d7b2fe2..d9da596e 100644 --- a/setup.cfg +++ b/setup.cfg @@ -44,12 +44,6 @@ keywords = setup-hooks = pbr.hooks.setup_hook -[build_sphinx] -source-dir = doc/source -build-dir = doc/build -all_files = 1 -warning-is-error = 1 - [files] packages = freezer @@ -65,9 +59,3 @@ console_scripts = freezer-agent = freezer.main:main -[pbr] -# Have pbr generate the module indexes like sphinx autodoc -autodoc_index_modules = True -api_doc_dir = reference/api -autodoc_exclude_modules = - freezer.scheduler.win* diff --git a/test-requirements.txt b/test-requirements.txt index 3470c6a8..cf46530b 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -7,11 +7,8 @@ coverage!=4.4,>=4.0 # Apache-2.0 ddt>=1.0.1 # MIT mock>=2.0.0 # BSD pylint==1.9.2 # GPLv2 -sphinx!=1.6.6,!=1.6.7,>=1.6.2 # BSD -openstackdocstheme>=1.18.1 # Apache-2.0 stestr>=2.0.0 # Apache-2.0 testtools>=2.2.0 # MIT -reno>=2.5.0 # Apache-2.0 astroid==1.6.5 # LGPLv2.1 # Tempest Plugin diff --git a/tox.ini b/tox.ini index a2618a77..380dfbad 100644 --- a/tox.ini +++ b/tox.ini @@ -57,11 +57,11 @@ basepython = python3.5 basepython = python3.6 [testenv:docs] +deps = -r{toxinidir}/doc/requirements.txt whitelist_externals = rm - bash commands = rm -rf doc/build/ - python setup.py build_sphinx + sphinx-build -b html doc/source doc/build/html [testenv:pep8] @@ -83,7 +83,11 @@ ignore = D000,D001 ignore-path = .venv,.git,.tox,.tmp,*freezer/locale*,*lib/python*,freezer.egg*,doc/build,releasenotes/*,doc/source/contributor/api [testenv:releasenotes] -commands = sphinx-build -a -E -d releasenotes/build/doctrees -b html releasenotes/source releasenotes/build/html +deps = -r{toxinidir}/doc/requirements.txt +whitelist_externals = rm +commands = + rm -rf releasenotes/build + sphinx-build -a -E -d releasenotes/build/doctrees -b html releasenotes/source releasenotes/build/html [testenv:lower-constraints] basepython = python3