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
- Cleanup doc/source/conf.py to remove now obsolete content.
- Use newer openstackdocstheme version
- Update hacking to version 3.0; remove hacking and friends
  from requirements, they are not needed; fix warnings found
- Use unittest.mock

Change-Id: I379c086a15477da4b0223fddd48035c829992c88
This commit is contained in:
Andreas Jaeger 2020-04-13 15:26:08 +02:00 committed by Pierre Riteau
parent da3ecf43eb
commit 26fda6b697
12 changed files with 15 additions and 46 deletions

View File

@ -10,8 +10,9 @@
# License for the specific language governing permissions and limitations # License for the specific language governing permissions and limitations
# under the License. # under the License.
from unittest import mock
from django.urls import reverse from django.urls import reverse
import mock
from openstack_dashboard import api from openstack_dashboard import api
from blazar_dashboard import api as blazar_api from blazar_dashboard import api as blazar_api

View File

@ -324,14 +324,14 @@ class UpdateForm(forms.SelfHandlingForm):
reservations = cleaned_data.get("reservations", None) reservations = cleaned_data.get("reservations", None)
if start_time: if start_time:
valid = re.match('^[+-]\d+[dhm]$', start_time) valid = re.match(r'^[+-]\d+[dhm]$', start_time)
if not valid: if not valid:
raise forms.ValidationError("The start/end time must be " raise forms.ValidationError("The start/end time must be "
"a form of +/- number d/h/m. " "a form of +/- number d/h/m. "
"(e.g. +1h)") "(e.g. +1h)")
if end_time: if end_time:
valid = re.match('^[+-]\d+[dhm]$', end_time) valid = re.match(r'^[+-]\d+[dhm]$', end_time)
if not valid: if not valid:
raise forms.ValidationError("The start/end time must be " raise forms.ValidationError("The start/end time must be "
"a form of +/- number d/h/m. " "a form of +/- number d/h/m. "

View File

@ -11,9 +11,9 @@
# under the License. # under the License.
from datetime import datetime from datetime import datetime
from unittest import mock
from django.urls import reverse from django.urls import reverse
import mock
import pytz import pytz
from blazar_dashboard import api from blazar_dashboard import api

View File

@ -176,6 +176,7 @@ class DummyHypervisor(object):
def __init__(self, host_name): def __init__(self, host_name):
self.hypervisor_hostname = host_name self.hypervisor_hostname = host_name
hypervisor_sample1 = DummyHypervisor('compute-1') hypervisor_sample1 = DummyHypervisor('compute-1')
hypervisor_sample2 = DummyHypervisor('compute-2') hypervisor_sample2 = DummyHypervisor('compute-2')

View File

@ -2,7 +2,7 @@
# 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.
openstackdocstheme>=1.18.1 # Apache-2.0 openstackdocstheme>=1.31.2 # Apache-2.0
sphinx>=1.8.0,!=2.1.0;python_version>='3.4' # BSD sphinx>=1.8.0,!=2.1.0 # BSD
reno>=2.5.0 # Apache-2.0 reno>=2.5.0 # Apache-2.0
sphinxcontrib-httpdomain>=1.3.0 # BSD sphinxcontrib-httpdomain>=1.3.0 # BSD

View File

@ -22,8 +22,6 @@
# All configuration values have a default; values that are commented out # All configuration values have a default; values that are commented out
# serve to show the default. # serve to show the default.
from blazar_dashboard.version import version_info as blazar_dashboard_version
# -- General configuration ---------------------------------------------------- # -- General configuration ----------------------------------------------------
# If your documentation needs a minimal Sphinx version, state it here. # If your documentation needs a minimal Sphinx version, state it here.
@ -57,15 +55,6 @@ master_doc = 'index'
project = u'Blazar dashboard' project = u'Blazar dashboard'
copyright = u'2017, OpenStack Foundation' copyright = u'2017, OpenStack Foundation'
# The version info for the project you're documenting, acts as replacement for
# |version| and |release|, also used in various other places throughout the
# built documents.
#
# Version info
release = blazar_dashboard_version.release_string()
# The short X.Y version.
version = blazar_dashboard_version.version_string()
# The language for content autogenerated by Sphinx. Refer to documentation # The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages. # for a list of supported languages.
# language = None # language = None
@ -137,9 +126,6 @@ html_theme = 'openstackdocs'
# so a file named "default.css" will overwrite the builtin "default.css". # so a file named "default.css" will overwrite the builtin "default.css".
# html_static_path = ['_static'] # html_static_path = ['_static']
# Must set this variable to include year, month, day, hours, and minutes.
html_last_updated_fmt = '%Y-%m-%d %H:%M'
# If true, SmartyPants will be used to convert quotes and dashes to # If true, SmartyPants will be used to convert quotes and dashes to
# typographically correct entities. # typographically correct entities.
# html_use_smartypants = True # html_use_smartypants = True

View File

@ -13,14 +13,11 @@ django-pyscss==2.0.2
Django==2.2 Django==2.2
extras==1.0.0 extras==1.0.0
fixtures==3.0.0 fixtures==3.0.0
flake8==2.5.5
hacking==1.1.0
horizon==17.1.0 horizon==17.1.0
idna==2.6 idna==2.6
iso8601==0.1.12 iso8601==0.1.12
keystoneauth1==3.4.0 keystoneauth1==3.4.0
linecache2==1.0.0 linecache2==1.0.0
mccabe==0.2.1
mock==2.0.0 mock==2.0.0
monotonic==1.4 monotonic==1.4
mox3==0.20.0 mox3==0.20.0
@ -38,9 +35,7 @@ oslo.utils==3.36.0
packaging==17.1 packaging==17.1
Parsley==1.3 Parsley==1.3
pbr==2.0.0 pbr==2.0.0
pep8==1.5.7
prettytable==0.7.2 prettytable==0.7.2
pyflakes==0.8.1
pyinotify==0.9.6 pyinotify==0.9.6
pyparsing==2.2.0 pyparsing==2.2.0
pyperclip==1.6.0 pyperclip==1.6.0

View File

@ -148,9 +148,6 @@ html_theme = 'openstackdocs'
# directly to the root of the documentation. # directly to the root of the documentation.
# html_extra_path = [] # html_extra_path = []
# Must set this variable to include year, month, day, hours, and minutes.
html_last_updated_fmt = '%Y-%m-%d %H:%M'
# If true, SmartyPants will be used to convert quotes and dashes to # If true, SmartyPants will be used to convert quotes and dashes to
# typographically correct entities. # typographically correct entities.
# html_use_smartypants = True # html_use_smartypants = True

View File

@ -6,6 +6,7 @@ description-file =
author = OpenStack author = OpenStack
author-email = openstack-discuss@lists.openstack.org author-email = openstack-discuss@lists.openstack.org
home-page = https://docs.openstack.org/blazar-dashboard/latest/ home-page = https://docs.openstack.org/blazar-dashboard/latest/
python-requires = >=3.6
classifier = classifier =
Environment :: OpenStack Environment :: OpenStack
Intended Audience :: Information Technology Intended Audience :: Information Technology
@ -13,6 +14,8 @@ classifier =
License :: OSI Approved :: Apache Software License License :: OSI Approved :: Apache Software License
Operating System :: POSIX :: Linux Operating System :: POSIX :: Linux
Programming Language :: Python Programming Language :: Python
Programming Language :: Python :: Implementation :: CPython
Programming Language :: Python :: 3 :: Only
Programming Language :: Python :: 3 Programming Language :: Python :: 3
Programming Language :: Python :: 3.6 Programming Language :: Python :: 3.6
Programming Language :: Python :: 3.7 Programming Language :: Python :: 3.7
@ -20,9 +23,3 @@ classifier =
[files] [files]
packages = packages =
blazar_dashboard blazar_dashboard
[build_sphinx]
all_files = 1
build-dir = doc/build
source-dir = doc/source
warning-is-error = 1

View File

@ -13,17 +13,8 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
# THIS FILE IS MANAGED BY THE GLOBAL REQUIREMENTS REPO - DO NOT EDIT
import setuptools 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( setuptools.setup(
setup_requires=['pbr>=2.0.0'], setup_requires=['pbr>=2.0.0'],
pbr=True) pbr=True)

View File

@ -7,7 +7,7 @@
# be installed in a specific order. # be installed in a specific order.
# #
# Hacking should appear first in case something else depends on pep8 # Hacking should appear first in case something else depends on pep8
hacking>=1.1.0,<1.2.0 # Apache-2.0 hacking>=3.0,<3.1.0 # Apache-2.0
# #
coverage!=4.4,>=4.0 # Apache-2.0 coverage!=4.4,>=4.0 # Apache-2.0
mock>=2.0.0 # BSD mock>=2.0.0 # BSD

View File

@ -44,7 +44,7 @@ commands =
deps = deps =
-c{env:UPPER_CONSTRAINTS_FILE:https://releases.openstack.org/constraints/upper/master} -c{env:UPPER_CONSTRAINTS_FILE:https://releases.openstack.org/constraints/upper/master}
-r{toxinidir}/doc/requirements.txt -r{toxinidir}/doc/requirements.txt
commands = python setup.py build_sphinx commands = sphinx-build -W -b html doc/source doc/build/pdf
[testenv:pdf-docs] [testenv:pdf-docs]
deps = -r{toxinidir}/doc/requirements.txt deps = -r{toxinidir}/doc/requirements.txt
@ -63,7 +63,8 @@ commands = sphinx-build -a -E -W -d releasenotes/build/doctrees --keep-going -b
[flake8] [flake8]
# F405 TEMPLATES may be undefined, or defined from star imports # F405 TEMPLATES may be undefined, or defined from star imports
# (because it is not easy to avoid this in openstack_dashboard.test.settings) # (because it is not easy to avoid this in openstack_dashboard.test.settings)
ignore = F405 # W504 line break after binary operator
ignore = F405,W504
exclude = .venv,.git,.tox,dist,*lib/python*,*egg,build,node_modules exclude = .venv,.git,.tox,dist,*lib/python*,*egg,build,node_modules
max-complexity = 20 max-complexity = 20