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
- Switch to using sphinx-build
- Use openstackdocstheme instead of python2 only oslosphinx
- Remove install_command from tox.ini, the default is fine
- Fix two hacking problems, those were masked by ignore
  to an empty string.

Change-Id: I8f67f8a7998a16805cbda52854a6b0f0ade05dc8
This commit is contained in:
Andreas Jaeger 2020-04-16 11:49:00 +02:00
parent 2396e14085
commit 5f293262c9
7 changed files with 22 additions and 27 deletions

View File

@ -21,9 +21,15 @@ sys.path.insert(0, os.path.abspath('../..'))
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom ones. # extensions coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
extensions = [ extensions = [
'sphinx.ext.autodoc', 'sphinx.ext.autodoc',
'oslosphinx', 'openstackdocstheme',
] ]
# -- Options for openstackdocstheme -------------------------------------------
repository_name = 'openstack/karbor-dashboard'
bug_project = 'karbor-dashboard'
bug_tag = ''
html_theme = 'openstackdocs'
# autodoc generation is a bit aggressive and a nuisance when doing heavy # autodoc generation is a bit aggressive and a nuisance when doing heavy
# text edit cycles. # text edit cycles.
# execute "export SPHINX_DEBUG=1" in your terminal to disable # execute "export SPHINX_DEBUG=1" in your terminal to disable

View File

@ -195,7 +195,7 @@ class CheckpointsRestoreView(horizon_forms.ModalFormView):
def get_context_data(self, **kwargs): def get_context_data(self, **kwargs):
context = super(CheckpointsRestoreView, self). \ context = super(CheckpointsRestoreView, self). \
get_context_data(**kwargs) get_context_data(**kwargs)
provider_id = self.kwargs['provider_id'] provider_id = self.kwargs['provider_id']
checkpoint_id = self.kwargs['checkpoint_id'] checkpoint_id = self.kwargs['checkpoint_id']
context['provider_id'] = provider_id context['provider_id'] = provider_id

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/karbor/latest/ home-page = https://docs.openstack.org/karbor/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,11 +23,3 @@ classifier =
[files] [files]
packages = packages =
karbor_dashboard karbor_dashboard
[build_sphinx]
source-dir = doc/source
build-dir = doc/build
all_files = 1
[upload_sphinx]
upload-dir = doc/build/html

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

@ -13,9 +13,9 @@ docutils>=0.11 # OSI-Approved Open Source, Public Domain
mock>=2.0.0 # BSD mock>=2.0.0 # BSD
mox3>=0.20.0 # Apache-2.0 mox3>=0.20.0 # Apache-2.0
nodeenv>=0.9.4 # BSD nodeenv>=0.9.4 # BSD
oslosphinx>=4.7.0 # Apache-2.0
selenium>=2.50.1 # Apache-2.0 selenium>=2.50.1 # Apache-2.0
sphinx!=1.6.6,!=1.6.7,!=2.1.0,>=1.6.2 # BSD openstackdocstheme>=2.0
sphinx>=2.0,!=2.1.0 # BSD
testtools>=2.2.0 # MIT testtools>=2.2.0 # MIT
# This also needs xvfb library installed on your OS # This also needs xvfb library installed on your OS
xvfbwrapper>=0.1.3 #license: MIT xvfbwrapper>=0.1.3 #license: MIT

View File

@ -72,8 +72,8 @@ class InstallVenv(object):
check_exit_code)[0] check_exit_code)[0]
def get_distro(self): def get_distro(self):
if (os.path.exists('/etc/fedora-release') or if (os.path.exists('/etc/fedora-release')
os.path.exists('/etc/redhat-release')): or os.path.exists('/etc/redhat-release')):
return Fedora( return Fedora(
self.root, self.venv, self.requirements, self.root, self.venv, self.requirements,
self.test_requirements, self.py_version, self.project) self.test_requirements, self.py_version, self.project)

11
tox.ini
View File

@ -7,13 +7,14 @@ ignore_basepython_conflict = True
[testenv] [testenv]
basepython = python3 basepython = python3
usedevelop = True usedevelop = True
install_command = pip install -c{env:UPPER_CONSTRAINTS_FILE:https://releases.openstack.org/constraints/upper/master} {opts} {packages}
setenv = VIRTUAL_ENV={envdir} setenv = VIRTUAL_ENV={envdir}
# Note the hash seed is set to 0 until horizon can be tested with a # Note the hash seed is set to 0 until horizon can be tested with a
# random hash seed successfully. # random hash seed successfully.
PYTHONHASHSEED=0 PYTHONHASHSEED=0
deps = -r{toxinidir}/requirements.txt deps =
-r{toxinidir}/test-requirements.txt -c{env:TOX_CONSTRAINTS_FILE:https://releases.openstack.org/constraints/upper/master}
-r{toxinidir}/requirements.txt
-r{toxinidir}/test-requirements.txt
commands = commands =
{toxinidir}/manage.py test karbor_dashboard --settings=karbor_dashboard.test.settings {toxinidir}/manage.py test karbor_dashboard --settings=karbor_dashboard.test.settings
@ -39,10 +40,12 @@ commands = nodeenv -p
[testenv:docs] [testenv:docs]
setenv = DJANGO_SETTINGS_MODULE=openstack_dashboard.test.settings setenv = DJANGO_SETTINGS_MODULE=openstack_dashboard.test.settings
commands = python setup.py build_sphinx commands = sphinx-build -W -b html doc/source doc/build/html
[flake8] [flake8]
exclude = .venv,.git,.tox,dist,*lib/python*,*egg,build,panel_template,dash_template,local_settings.py,*/local/*,*/test/test_plugins/*,.ropeproject exclude = .venv,.git,.tox,dist,*lib/python*,*egg,build,panel_template,dash_template,local_settings.py,*/local/*,*/test/test_plugins/*,.ropeproject
# W503 line break before binary operator
ignore = W503
max-complexity = 20 max-complexity = 20
[hacking] [hacking]