From a235a1534605ff9e139caab1db9a97fc976d7e97 Mon Sep 17 00:00:00 2001 From: Andreas Jaeger Date: Sun, 5 Apr 2020 17:47:02 +0200 Subject: [PATCH] Cleanup py27 support Make a few cleanups: - Remove python 2.7 stanza from setup.py - Add requires on python >= 3.6 to setup.cfg so that pypi and pip know about the requirement - Remove obsolete sections from setup.cfg - Update classifiers - Update requirements, no need for python_version anymore - Switch to apidoc instead of autodoc for API docs, use sphinx-build. Change-Id: Ie6107bc80961a7306957b17ac2eda44417b53d3e --- doc/source/conf.py | 11 ++++++++++- doc/source/reference/index.rst | 2 +- lower-constraints.txt | 1 + requirements.txt | 2 +- setup.cfg | 16 +++------------- setup.py | 9 --------- test-requirements.txt | 3 ++- tox.ini | 3 ++- 8 files changed, 20 insertions(+), 27 deletions(-) diff --git a/doc/source/conf.py b/doc/source/conf.py index 6b3d6b7e..d50bb597 100644 --- a/doc/source/conf.py +++ b/doc/source/conf.py @@ -5,9 +5,10 @@ # 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', +extensions = [ 'sphinx.ext.viewcode', 'openstackdocstheme', + 'sphinxcontrib.apidoc' ] wsme_protocols = ['restjson'] @@ -52,6 +53,14 @@ add_module_names = True # The name of the Pygments (syntax highlighting) style to use. pygments_style = 'sphinx' +# -- sphinxcontrib.apidoc configuration -------------------------------------- + +apidoc_module_dir = '../../ironic_lib' +apidoc_output_dir = 'reference/api' +apidoc_excluded_paths = [ + 'tests', +] + # -- Options for HTML output -------------------------------------------------- # The theme to use for HTML and HTML Help pages. Major themes that come with diff --git a/doc/source/reference/index.rst b/doc/source/reference/index.rst index 0953572f..500f9b30 100644 --- a/doc/source/reference/index.rst +++ b/doc/source/reference/index.rst @@ -5,4 +5,4 @@ Autogenerated API Reference .. toctree:: :maxdepth: 1 - api/autoindex + api/modules.rst diff --git a/lower-constraints.txt b/lower-constraints.txt index b15e0f06..8cfc4ee3 100644 --- a/lower-constraints.txt +++ b/lower-constraints.txt @@ -63,6 +63,7 @@ rfc3986==0.3.1 Routes==2.3.1 snowballstemmer==1.2.1 Sphinx==1.6.2 +sphinxcontrib-apidoc==0.2.0 sphinxcontrib-websupport==1.0.1 stestr==1.0.0 stevedore==1.20.0 diff --git a/requirements.txt b/requirements.txt index dc388a57..a2ff45f3 100644 --- a/requirements.txt +++ b/requirements.txt @@ -11,4 +11,4 @@ oslo.service!=1.28.1,>=1.24.0 # Apache-2.0 oslo.utils>=3.33.0 # Apache-2.0 requests>=2.14.2 # Apache-2.0 oslo.log>=3.36.0 # Apache-2.0 -zeroconf>=0.24.0;python_version>='3.0' # LGPL +zeroconf>=0.24.0 # LGPL diff --git a/setup.cfg b/setup.cfg index 5c62a0c6..6dc65ba9 100644 --- a/setup.cfg +++ b/setup.cfg @@ -6,6 +6,7 @@ description-file = author = OpenStack Ironic author-email = openstack-discuss@lists.openstack.org home-page = https://docs.openstack.org/ironic-lib/ +python-requires = >=3.6 classifier = Environment :: OpenStack Intended Audience :: Information Technology @@ -13,6 +14,8 @@ classifier = License :: OSI Approved :: Apache Software License Operating System :: POSIX :: Linux Programming Language :: Python + Programming Language :: Python :: Implementation :: CPython + Programming Language :: Python :: 3 :: Only Programming Language :: Python :: 3 Programming Language :: Python :: 3.6 Programming Language :: Python :: 3.7 @@ -32,16 +35,3 @@ oslo.config.opts = ironic_lib.metrics = ironic_lib.metrics_utils:list_opts ironic_lib.metrics_statsd = ironic_lib.metrics_statsd:list_opts ironic_lib.utils = ironic_lib.utils:list_opts - -[pbr] -autodoc_index_modules = True -autodoc_exclude_modules = - ironic_lib.common.i18n - ironic_lib.tests.* -api_doc_dir = reference/api - -[build_sphinx] -all_files = 1 -build-dir = doc/build -source-dir = doc/source -warning-is-error = 1 diff --git a/setup.py b/setup.py index 566d8443..cd35c3c3 100644 --- a/setup.py +++ b/setup.py @@ -13,17 +13,8 @@ # See the License for the specific language governing permissions and # limitations under the License. -# THIS FILE IS MANAGED BY THE GLOBAL REQUIREMENTS REPO - DO NOT EDIT import setuptools -# In python < 2.7.4, a lazy loading of package `pbr` will break -# setuptools if some other modules registered functions in `atexit`. -# solution from: http://bugs.python.org/issue15881#msg170215 -try: - import multiprocessing # noqa -except ImportError: - pass - setuptools.setup( setup_requires=['pbr>=2.0.0'], pbr=True) diff --git a/test-requirements.txt b/test-requirements.txt index 2e996f58..09edd5cd 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -14,5 +14,6 @@ testtools>=2.2.0 # MIT # Doc requirements doc8>=0.6.0 # Apache-2.0 -sphinx!=1.6.6,!=1.6.7,>=1.6.2;python_version>='3.4' # BSD +sphinx!=1.6.6,!=1.6.7,>=1.6.2 # BSD openstackdocstheme>=1.20.0 # Apache-2.0 +sphinxcontrib-apidoc>=0.2.0 # BSD diff --git a/tox.ini b/tox.ini index afc2bf42..c18ce389 100644 --- a/tox.ini +++ b/tox.ini @@ -58,7 +58,8 @@ setenv = PYTHONHASHSEED=0 sitepackages = False envdir = {toxworkdir}/venv commands = - python setup.py build_sphinx + sphinx-build -W -b html doc/source doc/build/html + [testenv:pdf-docs] whitelist_externals = make