From d6bc685ce09da5fc9c681f8fc68b110bdc1e40a4 Mon Sep 17 00:00:00 2001 From: Andreas Jaeger Date: Sun, 5 Apr 2020 18:10:08 +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 - Use sphinx-build, switch to apidoc for API building Change-Id: If1fc722a1ebaa8334642f1b632147bc939dfa3cc --- doc/source/conf.py | 10 +++++++++- doc/source/contributor/index.rst | 4 ++-- lower-constraints.txt | 1 + setup.cfg | 17 +++-------------- setup.py | 9 --------- test-requirements.txt | 3 ++- tox.ini | 2 +- 7 files changed, 18 insertions(+), 28 deletions(-) diff --git a/doc/source/conf.py b/doc/source/conf.py index e8373e2..5a6b081 100755 --- a/doc/source/conf.py +++ b/doc/source/conf.py @@ -32,7 +32,7 @@ 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', + 'sphinxcontrib.apidoc', 'oslo_config.sphinxext', 'oslo_config.sphinxconfiggen', 'openstackdocstheme', @@ -97,3 +97,11 @@ latex_documents = [ # Example configuration for intersphinx: refer to the Python standard library. #intersphinx_mapping = {'http://docs.python.org/': None} + +# -- sphinxcontrib.apidoc configuration -------------------------------------- + +apidoc_module_dir = '../../networking_baremetal' +apidoc_output_dir = 'contributor/api' +apidoc_excluded_paths = [ + 'tests', +] diff --git a/doc/source/contributor/index.rst b/doc/source/contributor/index.rst index a27dadc..86de62a 100644 --- a/doc/source/contributor/index.rst +++ b/doc/source/contributor/index.rst @@ -71,9 +71,9 @@ Full networking-baremetal python API reference * :ref:`modindex` -.. # api/autoindex is hidden since it's in the modindex link above. +.. # api/modules is hidden since it's in the modindex link above. .. toctree:: :hidden: - api/autoindex + api/modules diff --git a/lower-constraints.txt b/lower-constraints.txt index a6e2457..3f7ba3c 100644 --- a/lower-constraints.txt +++ b/lower-constraints.txt @@ -123,6 +123,7 @@ ryu==4.23 simplejson==3.13.2 snowballstemmer==1.2.1 Sphinx==1.6.2 +sphinxcontrib-apidoc==0.2.0 sphinxcontrib-websupport==1.0.1 sqlalchemy-migrate==0.11.0 SQLAlchemy==1.2.5 diff --git a/setup.cfg b/setup.cfg index dacf8f0..d2fd57b 100644 --- a/setup.cfg +++ b/setup.cfg @@ -6,6 +6,7 @@ description-file = author = OpenStack author-email = openstack-discuss@lists.openstack.org home-page = https://docs.openstack.org/networking-baremetal/latest/ +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 @@ -36,15 +39,6 @@ neutron.ml2.mechanism_drivers = autodoc_index_modules = True api_doc_dir = contributor/api -[build_sphinx] -source-dir = doc/source -build-dir = doc/build -all_files = 1 -warning-is-error = 1 - -[upload_sphinx] -upload-dir = doc/build/html - [compile_catalog] directory = networking_baremetal/locale domain = networking_baremetal @@ -58,8 +52,3 @@ input_file = networking_baremetal/locale/networking_baremetal.pot keywords = _ gettext ngettext l_ lazy_gettext mapping_file = babel.cfg output_file = networking_baremetal/locale/networking_baremetal.pot - -[build_releasenotes] -all_files = 1 -build-dir = releasenotes/build -source-dir = releasenotes/source diff --git a/setup.py b/setup.py index 566d844..cd35c3c 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 c761fe0..f3489a7 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -12,7 +12,8 @@ stestr>=1.0.0 # Apache-2.0 testscenarios>=0.4 # Apache-2.0/BSD # Doc requirements -sphinx!=1.6.6,!=1.6.7,!=2.1.0,>=1.6.2;python_version>='3.4' # BSD +sphinx!=1.6.6,!=1.6.7,!=2.1.0,>=1.6.2 # BSD +sphinxcontrib-apidoc>=0.2.0 # BSD openstackdocstheme>=1.20.0 # Apache-2.0 # releasenotes diff --git a/tox.ini b/tox.ini index ffac98f..d684f07 100644 --- a/tox.ini +++ b/tox.ini @@ -44,7 +44,7 @@ commands = setenv = PYTHONHASHSEED=0 sitepackages = False commands = - python setup.py build_sphinx + sphinx-build -W -b html doc/source doc/build/html [testenv:pdf-docs] whitelist_externals = make