From 3d06be24dc7cf97dac59761703beb4a254f9b67b Mon Sep 17 00:00:00 2001 From: Andreas Jaeger Date: Mon, 3 Feb 2020 21:15:28 +0100 Subject: [PATCH] Fix docs building In preparation for python 3 support switch to newer sphinx version. This requires openstackdocstheme. Remove install_command, this is the default. Update hacking version to be compatible with python 3, fix warnings from new pep8. Change-Id: Iab69ec59eb111571f784242c5ea5756c2a63e424 --- .gitignore | 1 + doc/requirements.txt | 3 +++ doc/source/conf.py | 20 ++++++++++++++++++-- doc/source/index.rst | 9 +++------ doc/source/usage.rst | 6 ++++-- os_performance_tools/collect.py | 1 + os_performance_tools/collectors/queues.py | 2 +- requirements.txt | 2 +- setup.cfg | 8 -------- test-requirements.txt | 6 ++---- tox.ini | 8 +++++--- 11 files changed, 39 insertions(+), 27 deletions(-) create mode 100644 doc/requirements.txt diff --git a/.gitignore b/.gitignore index 2e4ed08..8f9ea41 100644 --- a/.gitignore +++ b/.gitignore @@ -43,6 +43,7 @@ output/*/index.html # Sphinx doc/build +doc/source/reference/ # pbr generates these AUTHORS diff --git a/doc/requirements.txt b/doc/requirements.txt new file mode 100644 index 0000000..afd26e4 --- /dev/null +++ b/doc/requirements.txt @@ -0,0 +1,3 @@ +sphinx>=1.8.0,!=2.1.0 # BSD +openstackdocstheme>=1.30.0 # Apache-2.0 +sphinxcontrib-apidoc>=0.2.0 # BSD diff --git a/doc/source/conf.py b/doc/source/conf.py index ef9e1b5..9f0722e 100755 --- a/doc/source/conf.py +++ b/doc/source/conf.py @@ -20,11 +20,26 @@ sys.path.insert(0, os.path.abspath('../..')) # Add any Sphinx extension module names here, as strings. They can be # extensions coming with Sphinx (named 'sphinx.ext.*') or your custom ones. extensions = [ - 'sphinx.ext.autodoc', #'sphinx.ext.intersphinx', - 'oslosphinx' + 'openstackdocstheme', + 'sphinxcontrib.apidoc', ] +# openstackdocstheme options +repository_name = 'openstack/os-performance-tools' +bug_project = 'os-performance-tools' +bug_tag = '' + +html_theme = 'openstackdocs' + +# sphinxcontrib.apidoc options +apidoc_module_dir = '../../os_performance_tools' +apidoc_output_dir = 'reference/api' +apidoc_excluded_paths = [ + 'tests/*', + 'tests'] +apidoc_separate_modules = True + # autodoc generation is a bit aggressive and a nuisance when doing heavy # text edit cycles. # execute "export SPHINX_DEBUG=1" in your terminal to disable @@ -49,6 +64,7 @@ add_module_names = True # The name of the Pygments (syntax highlighting) style to use. pygments_style = 'sphinx' + # -- Options for HTML output -------------------------------------------------- # The theme to use for HTML and HTML Help pages. Major themes that come with diff --git a/doc/source/index.rst b/doc/source/index.rst index dd15f78..37f8ab6 100644 --- a/doc/source/index.rst +++ b/doc/source/index.rst @@ -1,10 +1,6 @@ -.. os-performance-tools documentation master file, created by - sphinx-quickstart on Tue Jul 9 22:26:36 2013. - You can adapt this file completely to your liking, but it should at least - contain the root `toctree` directive. - +================================================ Welcome to os-performance-tools's documentation! -======================================================== +================================================ Contents: @@ -15,6 +11,7 @@ Contents: installation usage contributing + reference/api/modules Indices and tables ================== diff --git a/doc/source/usage.rst b/doc/source/usage.rst index 6eedded..12b7525 100644 --- a/doc/source/usage.rst +++ b/doc/source/usage.rst @@ -1,6 +1,8 @@ -======== +===== Usage -======== +===== + +.. _counters: os-collect-counters ------------------- diff --git a/os_performance_tools/collect.py b/os_performance_tools/collect.py index d308707..e348023 100644 --- a/os_performance_tools/collect.py +++ b/os_performance_tools/collect.py @@ -95,5 +95,6 @@ def main(argv=None, stdout=None): output.write(content) output.write(b"\n") + if __name__ == '__main__': main() diff --git a/os_performance_tools/collectors/queues.py b/os_performance_tools/collectors/queues.py index b267315..6c83101 100644 --- a/os_performance_tools/collectors/queues.py +++ b/os_performance_tools/collectors/queues.py @@ -41,7 +41,7 @@ OS_QA_RABBITMQ_API_USER = os.environ.get('OS_QA_RABBITMQ_USER', 'guest') OS_QA_RABBITMQ_API_PASS = os.environ.get('OS_QA_RABBITMQ_PASS', 'guest') -FANOUT_RE = re.compile('([\-a-zA-Z0-9]+)_fanout_[a-f0-9]{32}') +FANOUT_RE = re.compile(r'([\-a-zA-Z0-9]+)_fanout_[a-f0-9]{32}') def collect(): diff --git a/requirements.txt b/requirements.txt index 31b3a86..a8f65ea 100644 --- a/requirements.txt +++ b/requirements.txt @@ -4,6 +4,6 @@ pbr>=1.6 PyMySQL>=0.6.2 # MIT License -statsd>=1.0.0,<3.0 +statsd>=1.0.0 oslo.config>=1.4.0.0a3 testtools>=1.4.0 diff --git a/setup.cfg b/setup.cfg index 2e4a82e..bae89f6 100644 --- a/setup.cfg +++ b/setup.cfg @@ -28,11 +28,3 @@ subunit2sql.target = [files] packages = os_performance_tools - -[build_sphinx] -source-dir = doc/source -build-dir = doc/build -all_files = 1 - -[upload_sphinx] -upload-dir = doc/build/html diff --git a/test-requirements.txt b/test-requirements.txt index ab77cb9..ff7aa79 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -2,13 +2,11 @@ # of appearance. Changing the order has an impact on the overall integration # process, which may cause wedges in the gate later. -hacking<0.11,>=0.10.0 +hacking<2.1,>=2.0 coverage>=3.6 -discover python-subunit>=0.0.18 -sphinx!=1.2.0,!=1.3b1,<1.3,>=1.1.2 -oslosphinx>=2.5.0 # Apache-2.0 + oslotest>=1.10.0 # Apache-2.0 testrepository>=0.0.18 testscenarios>=0.4 diff --git a/tox.ini b/tox.ini index 6a57f84..b525cfb 100644 --- a/tox.ini +++ b/tox.ini @@ -5,7 +5,6 @@ skipsdist = True [testenv] usedevelop = True -install_command = pip install -U {opts} {packages} setenv = VIRTUAL_ENV={envdir} deps = -r{toxinidir}/test-requirements.txt @@ -25,8 +24,11 @@ commands = python setup.py test --coverage --testr-args='{posargs}' [testenv:docs] basepython = python3 -commands = sphinx-apidoc -o doc/source os_performance_tools - python setup.py build_sphinx +deps = + -r{toxinidir}/test-requirements.txt + -r{toxinidir}/doc/requirements.txt +commands = + sphinx-build -W -b html -d doc/build/doctrees doc/source doc/build/html [testenv:debug] basepython = python3