Update docs building

Update docs building:
* Switch to sphinx-build
* Update requirements for Sphinx and openstackdocstheme for
  python 3, create doc/requirements.txt, switch to openstackdocstheme
  from obsolete oslosphinx
* Remove unneeded doc and translation sections from setup.cfg
* Remove install_command, it's unneeded, the default is fine.
* Move constraints into deps, use TOX_CONSTRAINTS instead of obsolete
  UPPER_CONSTRAINTS
* Switch to hacking 3.0, fix problems found

Change-Id: I44d09a65349a1d9b564e69a7fc32eb435446245c
This commit is contained in:
Andreas Jaeger
2020-05-03 11:56:34 +02:00
parent f75709dda5
commit a15380550b
7 changed files with 34 additions and 41 deletions

5
doc/requirements.txt Normal file
View File

@@ -0,0 +1,5 @@
sphinx>=2.0.0,!=2.1.0 # BSD
openstackdocstheme>=2.0.0 # Apache-2.0
# releasenotes
reno>=2.5.0 # Apache-2.0

View File

@@ -23,9 +23,14 @@ sys.path.insert(0, os.path.abspath('../..'))
extensions = [ extensions = [
'sphinx.ext.autodoc', 'sphinx.ext.autodoc',
#'sphinx.ext.intersphinx', #'sphinx.ext.intersphinx',
'oslosphinx' 'openstackdocstheme'
] ]
# openstackdocstheme options
repository_name = 'openstack/freezer-tempest-plugin'
bug_project = 'freezer'
bug_tag = ''
# autodoc generation is a bit aggressive and a nuisance when doing heavy # autodoc generation is a bit aggressive and a nuisance when doing heavy
# text edit cycles. # text edit cycles.
# execute "export SPHINX_DEBUG=1" in your terminal to disable # execute "export SPHINX_DEBUG=1" in your terminal to disable
@@ -57,6 +62,7 @@ pygments_style = 'sphinx'
# html_theme_path = ["."] # html_theme_path = ["."]
# html_theme = '_theme' # html_theme = '_theme'
# html_static_path = ['static'] # html_static_path = ['static']
html_theme = 'openstackdocs'
# Output file base name for HTML help builder. # Output file base name for HTML help builder.
htmlhelp_basename = '%sdoc' % project htmlhelp_basename = '%sdoc' % project

View File

@@ -48,8 +48,8 @@ class CommandFailed(Exception):
def dict_to_args(d): def dict_to_args(d):
l = [['--' + k.replace('_', '-'), v] for k, v in d.items()] li = [['--' + k.replace('_', '-'), v] for k, v in d.items()]
return list(itertools.chain.from_iterable(l)) return list(itertools.chain.from_iterable(li))
def execute_freezerc(dict, must_fail=False, merge_stderr=False): def execute_freezerc(dict, must_fail=False, merge_stderr=False):
@@ -250,8 +250,8 @@ class TestFS(unittest.TestCase):
os_region = os.environ.get('FREEZER_TEST_OS_REGION_NAME') os_region = os.environ.get('FREEZER_TEST_OS_REGION_NAME')
os_password = os.environ.get('FREEZER_TEST_OS_PASSWORD') os_password = os.environ.get('FREEZER_TEST_OS_PASSWORD')
os_auth_url = os.environ.get('FREEZER_TEST_OS_AUTH_URL') os_auth_url = os.environ.get('FREEZER_TEST_OS_AUTH_URL')
use_os = (os_tenant_name and os_user_name and os_region and use_os = (os_tenant_name and os_user_name and os_region
os_password and os_auth_url) and os_password and os_auth_url)
if use_os: if use_os:
os.environ['OS_USERNAME'] = os_user_name os.environ['OS_USERNAME'] = os_user_name
os.environ['OS_TENANT_NAME'] = os_tenant_name os.environ['OS_TENANT_NAME'] = os_tenant_name

View File

@@ -38,7 +38,7 @@
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom # extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
# ones. # ones.
extensions = [ extensions = [
'oslosphinx', 'openstackdocstheme',
'reno.sphinxext', 'reno.sphinxext',
] ]
@@ -58,6 +58,11 @@ master_doc = 'index'
project = u'freezer Release Notes' project = u'freezer Release Notes'
copyright = u'2016, OpenStack Foundation' copyright = u'2016, OpenStack Foundation'
# openstackdocstheme options
repository_name = 'openstack/freezer-tempest-plugin'
bug_project = 'freezer'
bug_tag = ''
# The version info for the project you're documenting, acts as replacement for # The version info for the project you're documenting, acts as replacement for
# |version| and |release|, also used in various other places throughout the # |version| and |release|, also used in various other places throughout the
# built documents. # built documents.
@@ -111,7 +116,7 @@ pygments_style = 'sphinx'
# The theme to use for HTML and HTML Help pages. See the documentation for # The theme to use for HTML and HTML Help pages. See the documentation for
# a list of builtin themes. # a list of builtin themes.
html_theme = 'default' html_theme = 'openstackdocs'
# Theme options are theme-specific and customize the look and feel of a theme # Theme options are theme-specific and customize the look and feel of a theme
# further. For a list of options available for each theme, see the # further. For a list of options available for each theme, see the

View File

@@ -22,29 +22,6 @@ classifier =
packages = packages =
freezer_tempest_plugin freezer_tempest_plugin
[build_sphinx]
all-files = 1
warning-is-error = 1
source-dir = doc/source
build-dir = doc/build
[upload_sphinx]
upload-dir = doc/build/html
[compile_catalog]
directory = freezer_tempest_plugin/locale
domain = freezer_tempest_plugin
[update_catalog]
domain = freezer_tempest_plugin
output_dir = freezer_tempest_plugin/locale
input_file = freezer_tempest_plugin/locale/freezer_tempest_plugin.pot
[extract_messages]
keywords = _ gettext ngettext l_ lazy_gettext
mapping_file = babel.cfg
output_file = freezer_tempest_plugin/locale/freezer_tempest_plugin.pot
[entry_points] [entry_points]
tempest.test_plugins = tempest.test_plugins =
freezer_tests = freezer_tempest_plugin.plugin:FreezerTempestPlugin freezer_tests = freezer_tempest_plugin.plugin:FreezerTempestPlugin

View File

@@ -2,10 +2,4 @@
# of appearance. Changing the order has an impact on the overall integration # of appearance. Changing the order has an impact on the overall integration
# process, which may cause wedges in the gate later. # process, which may cause wedges in the gate later.
hacking>=1.1.0,<1.2.0 # Apache-2.0 hacking>=3.0.0,<3.1.0 # Apache-2.0
sphinx!=1.6.6,!=1.6.7,>=1.6.2 # BSD
oslosphinx>=4.7.0 # Apache-2.0
# releasenotes
reno>=2.5.0 # Apache-2.0

14
tox.ini
View File

@@ -7,11 +7,12 @@ ignore_basepython_conflict = True
[testenv] [testenv]
basepython = python3 basepython = python3
usedevelop = True usedevelop = True
install_command = pip install -c{env:UPPER_CONSTRAINTS_FILE:https://opendev.org/openstack/requirements/raw/branch/master/upper-constraints.txt} {opts} {packages}
setenv = setenv =
VIRTUAL_ENV={envdir} VIRTUAL_ENV={envdir}
PYTHONWARNINGS=default::DeprecationWarning PYTHONWARNINGS=default::DeprecationWarning
deps = -r{toxinidir}/test-requirements.txt deps =
-c{env:TOX_CONSTRAINTS_FILE:https://releases.openstack.org/constraints/upper/master}
-r{toxinidir}/test-requirements.txt
commands = python setup.py test --slowest --testr-args='{posargs}' commands = python setup.py test --slowest --testr-args='{posargs}'
[testenv:pep8] [testenv:pep8]
@@ -24,9 +25,13 @@ commands = {posargs}
commands = python setup.py test --coverage --testr-args='{posargs}' commands = python setup.py test --coverage --testr-args='{posargs}'
[testenv:docs] [testenv:docs]
commands = python setup.py build_sphinx deps =
-c{env:TOX_CONSTRAINTS_FILE:https://releases.openstack.org/constraints/upper/master}
-r{toxinidir}/doc/requirements.txt
commands = sphinx-build -W -b html doc/source doc/build/html
[testenv:releasenotes] [testenv:releasenotes]
deps = {[testenv:docs]deps}
commands = commands =
sphinx-build -a -E -W -d releasenotes/build/doctrees -b html releasenotes/source releasenotes/build/html sphinx-build -a -E -W -d releasenotes/build/doctrees -b html releasenotes/source releasenotes/build/html
@@ -34,7 +39,8 @@ commands =
commands = oslo_debug_helper {posargs} commands = oslo_debug_helper {posargs}
[flake8] [flake8]
ignore = H405,H404,H403,H401 # W503 line break before binary operator
ignore = H405,H404,H403,H401,W503
show-source = True show-source = True
enable-extensions = H203,H106 enable-extensions = H203,H106
exclude = .venv,.tox,dist,doc,test,*egg,releasenotes exclude = .venv,.tox,dist,doc,test,*egg,releasenotes