From 6d253ca7f1542c758dc1d55074fc5fba13060153 Mon Sep 17 00:00:00 2001 From: Andreas Jaeger Date: Tue, 9 Jun 2020 13:52:39 +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 - Remove install_command from tox.ini, the default is fine - Use TOX_CONSTRAINTS_FILE instead of obsolete UPPER_CONSTRAINTS_FILE. - Update hacking to current version 3.1.0, fix problems found. Change-Id: I86c18b4c73f9b3dc0b3d804559d825dac5a78436 --- ironic_ui/api/ironic_rest_api.py | 3 +-- ironic_ui/content/ironic/panel.py | 1 + ironic_ui/test/settings.py | 16 ++++++++-------- lower-constraints.txt | 1 - setup.cfg | 16 +++------------- setup.py | 9 --------- test-requirements.txt | 2 +- tox.ini | 8 +++++--- 8 files changed, 19 insertions(+), 37 deletions(-) diff --git a/ironic_ui/api/ironic_rest_api.py b/ironic_ui/api/ironic_rest_api.py index e7e6d442..ac62bb82 100755 --- a/ironic_ui/api/ironic_rest_api.py +++ b/ironic_ui/api/ironic_rest_api.py @@ -455,8 +455,7 @@ class RaidConfig(generic.View): @urls.register class DriverDetails(generic.View): - url_regex = r'ironic/drivers/(?P[0-9a-zA-Z_-]+)$'. \ - format(LOGICAL_NAME_PATTERN) + url_regex = r'ironic/drivers/(?P[0-9a-zA-Z_-]+)$' @rest_utils.ajax() def get(self, request, driver_name): diff --git a/ironic_ui/content/ironic/panel.py b/ironic_ui/content/ironic/panel.py index ac67b517..ae546bc7 100644 --- a/ironic_ui/content/ironic/panel.py +++ b/ironic_ui/content/ironic/panel.py @@ -40,4 +40,5 @@ class Ironic(horizon.Panel): else: return True + dashboard.Admin.register(Ironic) diff --git a/ironic_ui/test/settings.py b/ironic_ui/test/settings.py index 4feed0e9..ffe5ac36 100644 --- a/ironic_ui/test/settings.py +++ b/ironic_ui/test/settings.py @@ -19,22 +19,22 @@ from openstack_dashboard.test.settings import * # noqa # pop these keys to avoid log warnings about deprecation # update_dashboards will populate them anyway -HORIZON_CONFIG.pop('dashboards', None) -HORIZON_CONFIG.pop('default_dashboard', None) +HORIZON_CONFIG.pop('dashboards', None) # noqa: F405 +HORIZON_CONFIG.pop('default_dashboard', None) # noqa: F405 # Update the dashboards with ironic_ui -import ironic_ui.enabled -import openstack_dashboard.enabled -from openstack_dashboard.utils import settings +import ironic_ui.enabled # noqa: E402 +import openstack_dashboard.enabled # noqa: E402 +from openstack_dashboard.utils import settings # noqa: E402 settings.update_dashboards( [ ironic_ui.enabled, openstack_dashboard.enabled, ], - HORIZON_CONFIG, - INSTALLED_APPS + HORIZON_CONFIG, # noqa: F405 + INSTALLED_APPS # noqa: F405 ) # Ensure any duplicate apps are removed after the update_dashboards call -INSTALLED_APPS = list(set(INSTALLED_APPS)) +INSTALLED_APPS = list(set(INSTALLED_APPS)) # noqa: F405 diff --git a/lower-constraints.txt b/lower-constraints.txt index c6564fca..8a7d1a8d 100644 --- a/lower-constraints.txt +++ b/lower-constraints.txt @@ -1,7 +1,6 @@ alabaster==0.7.10 appdirs==1.4.3 asn1crypto==0.24.0 -Babel==2.5.3 certifi==2018.1.18 cffi==1.11.5 chardet==3.0.4 diff --git a/setup.cfg b/setup.cfg index 618464c8..f490ad68 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/ironic-ui/latest/ +python-requires = >=3.6 classifier = Environment :: OpenStack Intended Audience :: Information Technology @@ -13,24 +14,13 @@ 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 Programming Language :: Python :: 3.8 -[pbr] -autodoc_index_modules = True -autodoc_exclude_modules = - ironic_ui.test.* -api_doc_dir = contributor/api - [files] packages = ironic_ui - -[upload_sphinx] -upload-dir = doc/build/html - -[compile_catalog] -directory = ironic_ui/locale -domain = ironic-ui 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 7cb47f44..ae17714c 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.13.0,<0.14,>=0.12.0 # Apache-2.0 +hacking>=3.1.0,<=3.2.0 # Apache-2.0 coverage!=4.4,>=4.0 # Apache-2.0 python-subunit>=1.0.0 # Apache-2.0/BSD diff --git a/tox.ini b/tox.ini index a62bc18d..3003d788 100644 --- a/tox.ini +++ b/tox.ini @@ -14,7 +14,7 @@ setenv = VIRTUAL_ENV={envdir} NOSE_OPENSTACK_YELLOW=0.025 NOSE_OPENSTACK_SHOW_ELAPSED=1 DJANGO_SETTINGS_MODULE=ironic_ui.test.settings -deps = -c{env:UPPER_CONSTRAINTS_FILE:https://releases.openstack.org/constraints/upper/master} +deps = -c{env:TOX_CONSTRAINTS_FILE:https://releases.openstack.org/constraints/upper/master} -r{toxinidir}/requirements.txt -r{toxinidir}/test-requirements.txt commands = @@ -47,7 +47,7 @@ commands = python setup.py test --coverage --testr-args='{posargs}' [testenv:docs] deps = - -c{env:UPPER_CONSTRAINTS_FILE:https://releases.openstack.org/constraints/upper/master} + -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 @@ -66,11 +66,13 @@ commands = oslo_debug_helper -t ironic_ui/test/tests {posargs} show-source = True builtins = _ +# [W503] Line break before binary operator. +ignore = W503 exclude=.venv,.git,.tox,dist,doc,*lib/python*,*egg,build [testenv:releasenotes] deps = - -c{env:UPPER_CONSTRAINTS_FILE:https://releases.openstack.org/constraints/upper/master} + -c{env:TOX_CONSTRAINTS_FILE:https://releases.openstack.org/constraints/upper/master} -r{toxinidir}/doc/requirements.txt commands = sphinx-build -a -W -E -d releasenotes/build/doctrees -b html releasenotes/source releasenotes/build/html