From 2abc37868b534611eb5433fa9f1466419706dbf3 Mon Sep 17 00:00:00 2001 From: Andreas Jaeger Date: Mon, 13 Apr 2020 11:25:17 +0200 Subject: [PATCH] Cleanup py27 support This repo is now testing only with Python 3, so let's 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 using sphinx-build - Use newer openstackdocstheme version - Remove install_command from tox.ini, the default is fine - Update to hacking 3.0, fix warnings Change-Id: If66a87c519ce82ee7890ac3e133afef13fb35bd2 --- doc/requirements.txt | 5 ++--- osc_placement/http.py | 4 ++-- osc_placement/resources/inventory.py | 4 ++-- setup.cfg | 16 +++------------- setup.py | 9 --------- test-requirements.txt | 2 +- tox.ini | 5 ++--- 7 files changed, 12 insertions(+), 33 deletions(-) diff --git a/doc/requirements.txt b/doc/requirements.txt index 145b889..935dc9e 100644 --- a/doc/requirements.txt +++ b/doc/requirements.txt @@ -1,10 +1,9 @@ # The order of packages is significant, because pip processes them in the order # of appearance. Changing the order has an impact on the overall integration # process, which may cause wedges in the gate later. -sphinx!=1.6.6,!=1.6.7,>=1.6.2,<2.0.0;python_version=='2.7' # BSD -sphinx!=1.6.6,!=1.6.7,>=1.6.2,!=2.1.0;python_version>='3.4' # BSD +sphinx!=1.6.6,!=1.6.7,>=1.6.2,!=2.1.0 # BSD sphinx-feature-classification>=0.2.0 # Apache-2.0 -openstackdocstheme>=1.24.0 # Apache-2.0 +openstackdocstheme>=1.31.2 # Apache-2.0 cliff>=2.14 # releasenotes diff --git a/osc_placement/http.py b/osc_placement/http.py index 27d82ca..03f56a2 100644 --- a/osc_placement/http.py +++ b/osc_placement/http.py @@ -47,8 +47,8 @@ class SessionClient(object): def request(self, method, url, **kwargs): version = kwargs.pop('version', None) - api_version = (self.ks_filter['service_type'] + ' ' + - (version or self.api_version)) + api_version = (self.ks_filter['service_type'] + ' ' + + (version or self.api_version)) headers = kwargs.pop('headers', {}) headers.setdefault('OpenStack-API-Version', api_version) headers.setdefault('Accept', 'application/json') diff --git a/osc_placement/resources/inventory.py b/osc_placement/resources/inventory.py index e204f5e..20abbb0 100644 --- a/osc_placement/resources/inventory.py +++ b/osc_placement/resources/inventory.py @@ -326,8 +326,8 @@ class DeleteInventory(command.Command, version.CheckerMixin): '--resource-class', metavar='', required=self.compare_version(version.lt('1.5')), - help=(RC_HELP + - '\nThis argument can be omitted starting with ' + help=(RC_HELP + + '\nThis argument can be omitted starting with ' '``--os-placement-api-version 1.5``. If it is omitted all ' 'inventories of the specified resource provider ' 'will be deleted.') diff --git a/setup.cfg b/setup.cfg index 8bc9834..d97ebc4 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/osc-placement/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 @@ -58,14 +61,6 @@ openstack.placement.v1 = resource_provider_trait_delete = osc_placement.resources.trait:DeleteResourceProviderTrait allocation_candidate_list = osc_placement.resources.allocation_candidate:ListAllocationCandidate -[build_sphinx] -source-dir = doc/source -build-dir = doc/build -all_files = 1 - -[upload_sphinx] -upload-dir = doc/build/html - [compile_catalog] directory = osc_placement/locale domain = osc_placement @@ -79,8 +74,3 @@ input_file = osc_placement/locale/osc_placement.pot keywords = _ gettext ngettext l_ lazy_gettext mapping_file = babel.cfg output_file = osc_placement/locale/osc_placement.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 2b84a1c..14e1e2b 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -2,7 +2,7 @@ # of appearance. Changing the order has an impact on the overall integration # process, which may cause wedges in the gate later. -hacking>=0.12.0,<0.13 # Apache-2.0 +hacking>=3.0,<3.1.0 # Apache-2.0 coverage>=4.0 # Apache-2.0 oslotest>=1.10.0 # Apache-2.0 diff --git a/tox.ini b/tox.ini index b6c3cfe..9ce0679 100644 --- a/tox.ini +++ b/tox.ini @@ -12,7 +12,6 @@ basepython = python3 usedevelop = True whitelist_externals = rm -install_command = pip install {opts} {packages} setenv = VIRTUAL_ENV={envdir} PYTHONWARNINGS=ignore::DeprecationWarning:distutils,ignore::DeprecationWarning:site @@ -84,8 +83,8 @@ commands = oslo_debug_helper {posargs} [flake8] # E123, E125 skipped as they are invalid PEP-8. - +# W503 line break before binary operator show-source = True -ignore = E123,E125 +ignore = E123,E125,W503 builtins = _ exclude=.venv,.git,.tox,dist,doc,*lib/python*,*egg,build