From 68ab6a01b69b7054dda6bef7e59109465c19bc49 Mon Sep 17 00:00:00 2001 From: Andreas Jaeger Date: Wed, 20 May 2020 09:32:59 +0200 Subject: [PATCH] Switch to newer openstackdocstheme and reno versions Switch to openstackdocstheme 2.2.0 and reno 3.1.0 versions. Using these versions will allow especially: * Linking from HTML to PDF document * Allow parallel building of documents * Fix some rendering problems Update Sphinx version as well. Set openstackdocs_pdf_link to link to PDF file. Note that the link to the published document only works on docs.openstack.org where the PDF file is placed in the top-level html directory. The site-preview places the PDF in a pdf directory. Set openstackdocs_auto_version to not auto-version the documents. Set openstackdocs_auto_name to use 'project' as name. Change pygments_style to 'native' since old theme version always used 'native' and the theme now respects the setting and using 'sphinx' can lead to some strange rendering. openstackdocstheme renames some variables, so follow the renames before the next release removes them. A couple of variables are also not needed anymore, remove them. Change-Id: I9591e0f0215e9eb790ec2e3ea1a7ccbd55bb76d0 --- api-ref/source/conf.py | 36 ++++-------------------------------- doc/source/conf.py | 9 +++++---- lower-constraints.txt | 6 +++--- releasenotes/source/conf.py | 9 ++++----- test-requirements.txt | 6 +++--- 5 files changed, 19 insertions(+), 47 deletions(-) diff --git a/api-ref/source/conf.py b/api-ref/source/conf.py index ebaa0d340..3908886c0 100644 --- a/api-ref/source/conf.py +++ b/api-ref/source/conf.py @@ -23,11 +23,7 @@ # serve to show the default. import os -import subprocess import sys -import warnings - -import openstackdocstheme extensions = [ 'os_api_ref', @@ -36,12 +32,10 @@ extensions = [ html_theme = 'openstackdocs' -html_theme_path = [openstackdocstheme.get_html_theme_path()] html_theme_options = { "sidebar_dropdown": "api_ref", "sidebar_mode": "toc", } -html_context = {'bug_project': 'ironic-inspector', 'bug_tag': 'api-ref'} # If extensions (or modules to document with autodoc) are in another directory, # add these directories to sys.path here. If the directory is relative to the @@ -66,25 +60,14 @@ source_suffix = '.rst' master_doc = 'index' # openstackdocstheme options -repository_name = 'openstack/ironic-inspector' -use_storyboard = True -bug_project = 'openstack/ironic-inspector' -bug_tag = 'api-ref' +openstackdocs_repo_name = 'openstack/ironic-inspector' +openstackdocs_use_storyboard = True +openstackdocs_auto_name = False # General information about the project. project = 'Hardware Introspection API Reference' copyright = '2017-present, Ironic Inspector Developers' -# The version info for the project you're documenting, acts as replacement for -# |version| and |release|, also used in various other places throughout the -# built documents. -# -from ironic_inspector.version import version_info -# The full version, including alpha/beta/rc tags. -release = version_info.release_string() -# The short X.Y version. -version = version_info.version_string() - # The language for content autogenerated by Sphinx. Refer to documentation # for a list of supported languages. # @@ -112,7 +95,7 @@ add_module_names = False show_authors = False # The name of the Pygments (syntax highlighting) style to use. -pygments_style = 'sphinx' +pygments_style = 'native' # -- Options for man page output ---------------------------------------------- @@ -156,17 +139,6 @@ pygments_style = 'sphinx' # so a file named "default.css" will overwrite the builtin "default.css". # html_static_path = ['_static'] -# If not '', a 'Last updated on:' timestamp is inserted at every page bottom, -# using the given strftime format. -# html_last_updated_fmt = '%b %d, %Y' -git_cmd = ["git", "log", "--pretty=format:'%ad, commit %h'", "--date=local", - "-n1"] -try: - html_last_updated_fmt = subprocess.check_output(git_cmd).decode('utf-8') -except Exception: - warnings.warn('Cannot get last updated time from git repository. ' - 'Not setting "html_last_updated_fmt".') - # If true, SmartyPants will be used to convert quotes and dashes to # typographically correct entities. # html_use_smartypants = True diff --git a/doc/source/conf.py b/doc/source/conf.py index 12c8f1e3a..f9ace66fe 100644 --- a/doc/source/conf.py +++ b/doc/source/conf.py @@ -19,9 +19,10 @@ try: except ImportError: openstackdocstheme = None -repository_name = 'openstack/ironic-inspector' -use_storyboard = True -openstack_projects = [ +openstackdocs_repo_name = 'openstack/ironic-inspector' +openstackdocs_pdf_link = True +openstackdocs_use_storyboard = True +openstackdocs_projects = [ 'bifrost', 'devstack', 'ironic', @@ -78,7 +79,7 @@ add_function_parentheses = True add_module_names = True # The name of the Pygments (syntax highlighting) style to use. -pygments_style = 'sphinx' +pygments_style = 'native' # NOTE(cinerama): mock out nova modules so docs can build without warnings #import mock diff --git a/lower-constraints.txt b/lower-constraints.txt index 1478b6358..8ce96ea67 100644 --- a/lower-constraints.txt +++ b/lower-constraints.txt @@ -18,7 +18,7 @@ keystoneauth1==3.14.0 keystonemiddleware==4.18.0 mock==3.0.0 netaddr==0.7.18 -openstackdocstheme==1.31.2 +openstackdocstheme==2.2.0 openstacksdk==0.40.0 os-api-ref==1.4.0 oslo.concurrency==3.26.0 @@ -38,9 +38,9 @@ oslo.utils==3.33.0 pbr==2.0.0 pymemcache==1.2.9 pytz==2013.6 -reno==2.5.0 +reno==3.1.0 retrying==1.2.3 -sphinx==1.6.2 +Sphinx==2.0.0 sphinxcontrib-apidoc==0.2.0 sphinxcontrib-svg2pdfconverter==0.1.0 SQLAlchemy==1.0.10 diff --git a/releasenotes/source/conf.py b/releasenotes/source/conf.py index c09a04fbf..12ec71842 100644 --- a/releasenotes/source/conf.py +++ b/releasenotes/source/conf.py @@ -47,10 +47,9 @@ try: except ImportError: openstackdocstheme = None -repository_name = 'openstack/ironic-inspector' -bug_project = 'ironic-inspector' -bug_tag = '' -html_last_updated_fmt = '%Y-%m-%d %H:%M' +openstackdocs_repo_name = 'openstack/ironic-inspector' +openstackdocs_use_storyboard = True +openstackdocs_auto_name = False # Add any paths that contain templates here, relative to this directory. templates_path = ['_templates'] @@ -104,7 +103,7 @@ exclude_patterns = [] # show_authors = False # The name of the Pygments (syntax highlighting) style to use. -pygments_style = 'sphinx' +pygments_style = 'native' # A list of ignored prefixes for module index sorting. # modindex_common_prefix = [] diff --git a/test-requirements.txt b/test-requirements.txt index 7c53d8f54..890246448 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -7,13 +7,13 @@ coverage!=4.4,>=4.0 # Apache-2.0 doc8>=0.6.0 # Apache-2.0 flake8-import-order>=0.17.1 # LGPLv3 hacking>=3.0.0,<3.1.0 # Apache-2.0 -sphinx!=1.6.6,!=1.6.7,>=1.6.2 # BSD +sphinx>=2.0.0,!=2.1.0 # BSD sphinxcontrib-svg2pdfconverter>=0.1.0 # BSD sphinxcontrib-apidoc>=0.2.0 # BSD -openstackdocstheme>=1.31.2 # Apache-2.0 +openstackdocstheme>=2.2.0 # Apache-2.0 os-api-ref>=1.4.0 # Apache-2.0 pymemcache!=1.3.0,>=1.2.9 # Apache 2.0 License stestr>=1.0.0 # Apache-2.0 -reno>=2.5.0 # Apache-2.0 +reno>=3.1.0 # Apache-2.0 fixtures>=3.0.0 # Apache-2.0/BSD oslotest>=3.2.0 # Apache-2.0