networking-vsphere: switch to python 3.x

Change-Id: I1380a9ccc40df6b4c5bcc7067089c4ca836ea3a6
This commit is contained in:
Dirk Mueller 2019-07-15 18:53:43 +02:00
parent 7c7ac3b998
commit ec932a5e28
2 changed files with 144 additions and 47 deletions

View File

@ -0,0 +1,95 @@
From f889b11c8dcea898dd3a0a7b55ba5b74600a53af Mon Sep 17 00:00:00 2001
From: Dirk Mueller <dirk@dmllr.de>
Date: Tue, 16 Jul 2019 23:00:46 +0200
Subject: [PATCH] Switch documentation build to python3
oslosphinx is not compatible with python 3/sphinx2, so we need
to either switch to openstackdocstheme or remove oslosphinx.
Also switch tox environments to use python 3 by default including
docs and switch to sphinx-build.
Change-Id: I76b9417d77241a9e8d8ac3c9bdaf4ebddae1e0ab
---
doc/source/conf.py | 1 -
test-requirements.txt | 1 -
tox.ini | 11 +++++------
3 files changed, 5 insertions(+), 8 deletions(-)
diff --git a/doc/source/conf.py b/doc/source/conf.py
index f0b0465..a2213a6 100755
--- a/doc/source/conf.py
+++ b/doc/source/conf.py
@@ -23,7 +23,6 @@ sys.path.insert(0, os.path.abspath('../..'))
extensions = [
'sphinx.ext.autodoc',
#'sphinx.ext.intersphinx',
- 'oslosphinx'
]
# autodoc generation is a bit aggressive and a nuisance when doing heavy
diff --git a/test-requirements.txt b/test-requirements.txt
index 34a038c..8aef4cf 100644
--- a/test-requirements.txt
+++ b/test-requirements.txt
@@ -9,7 +9,6 @@ mock>=2.0.0 # BSD
coverage!=4.4,>=4.0 # Apache-2.0
python-subunit>=1.0.0 # Apache-2.0/BSD
sphinx!=1.6.6,!=1.6.7,>=1.6.5 # BSD
-oslosphinx>=4.7.0 # Apache-2.0
oslotest>=3.2.0 # Apache-2.0
stestr>=1.0.0 # Apache-2.0
diff --git a/tox.ini b/tox.ini
index 1844d70..28f91d0 100644
--- a/tox.ini
+++ b/tox.ini
@@ -4,6 +4,7 @@ minversion = 1.6
skipsdist = True
[testenv]
+basepython = python3
setenv = VIRTUAL_ENV={envdir}
passenv = TRACE_FAILONLY
usedevelop = True
@@ -17,7 +18,6 @@ commands = stestr run {posargs}
# mode. To do this define the TRACE_FAILONLY environmental variable.
[testenv:scenario]
-basepython = python3
setenv = OS_TEST_PATH=./networking_vsphere/tests/scenario
passenv = {[testenv]passenv} TEMPEST_CONFIG_DIR
# If you are running the tests locally you should set the env variable
@@ -25,18 +25,18 @@ passenv = {[testenv]passenv} TEMPEST_CONFIG_DIR
[testenv:pep8]
commands = flake8
+### NOTE(dmllr): Remove after upgrading at a recent hacking/flake8
+basepython = python2
[testenv:venv]
-basepython = python3
commands = {posargs}
[testenv:cover]
-basepython = python3
commands = python setup.py testr --coverage --testr-args='{posargs}'
[testenv:docs]
-basepython = python3
-commands = python setup.py build_sphinx
+commands =
+ sphinx-build -W -b html doc/source doc/build/html
[flake8]
# E123 closing bracket does not match indentation of opening bracket's line
@@ -59,7 +59,6 @@ import_exceptions = networking_vsphere._i18n
local-check-factory = neutron_lib.hacking.checks.factory
[testenv:lower-constraints]
-basepython = python3
setenv = OS_TEST_TIMEOUT={env:OS_TEST_TIMEOUT:60}
deps = -c{toxinidir}/lower-constraints.txt
-r{toxinidir}/requirements.txt
--
2.22.0

View File

@ -13,11 +13,24 @@ Source0: {{ source|basename }}
Source1: openstack-neutron-dvs-agent.service
Source2: openstack-neutron-ovsvapp-agent.service
Source3: openstack-neutron-ovsvapp-agent-monitor.service
# https://review.opendev.org/#/c/671155/
Patch1: 0001-Switch-documentation-build-to-python3.patch
BuildRequires: fdupes
BuildRequires: openstack-macros
BuildRequires: {{ py2pkg('devel') }}
BuildRequires: {{ py2pkg('pbr') }}
Requires: python-{{ pypi_name }} = %{version}-%{release}
BuildRequires: {{ py3('Babel') }}
BuildRequires: {{ py3('devel') }}
BuildRequires: {{ py3('kombu') }}
BuildRequires: {{ py3('mock') }}
BuildRequires: python3-nova
BuildRequires: {{ py3('oslo.vmware') }}
BuildRequires: {{ py3('oslotest') }}
BuildRequires: {{ py3('ovsdbapp') }}
BuildRequires: {{ py3('pbr') }}
BuildRequires: {{ py3('testrepository') }}
BuildRequires: {{ py3('testresources') }}
BuildRequires: {{ py3('testscenarios') }}
BuildRequires: {{ py3('testtools') }}
Requires: python3-{{ pypi_name }} = %{version}-%{release}
BuildArch: noarch
%if 0%{?suse_version}
BuildRequires: systemd-rpm-macros
@ -34,15 +47,16 @@ Neutron ML2 drivers and L2 agents for OVSvApp - a Neutron supported
solution for vSphere deployments in the form of a service VM called
OVSvApp VM which steers the ESX tenant VMs' traffic through it.
%package -n python-{{ pypi_name }}
%package -n python3-{{ pypi_name }}
Summary: OVSvApp and DVS Drivers - Python libraries
Requires: {{ py2pkg('Babel') }}
Requires: python-neutron
Requires: python-nova
Requires: {{ py2pkg('oslo.vmware') }}
Requires: {{ py2pkg('ovsdbapp') }}
Requires: {{ py3('Babel') }}
# NOTE(dmllr): Todo, need to unwind recursive dependencies
#Requires: python3-neutron
Requires: python3-nova
Requires: {{ py3('oslo.vmware') }}
Requires: {{ py3('ovsdbapp') }}
%description -n python-{{ pypi_name }}
%description -n python3-{{ pypi_name }}
The OVSvApp solution comprises of a service VM called OVSvApp VM hosted on each
ESXi hypervisor within a cluster and two vSphere Distributed Switches (VDS).
Two ML2 mechanism drivers are provided for Neutron - one for OVSvApp and
@ -70,8 +84,8 @@ Contains the OVSvApp agent services for %{name}
%package doc
Summary: Documentation for %{name}
Group: Documentation/HTML
BuildRequires: {{ py2pkg('Sphinx') }}
BuildRequires: {{ py2pkg('oslosphinx') }}
BuildRequires: {{ py3('Sphinx') }}
BuildRequires: {{ py3('oslosphinx') }}
%description doc
This package contains extra documentation for %{name}.
@ -79,26 +93,14 @@ This package contains extra documentation for %{name}.
%package test
Summary: Testsuite for the OVSvApp VMware
Group: System/Management
BuildRequires: {{ py2pkg('Babel') }}
BuildRequires: {{ py2pkg('kombu') }}
BuildRequires: {{ py2pkg('mock') }}
BuildRequires: python-neutron
BuildRequires: python-nova
BuildRequires: {{ py2pkg('oslo.vmware') }}
BuildRequires: {{ py2pkg('oslotest') }}
BuildRequires: {{ py2pkg('ovsdbapp') }}
BuildRequires: {{ py2pkg('testrepository') }}
BuildRequires: {{ py2pkg('testresources') }}
BuildRequires: {{ py2pkg('testscenarios') }}
BuildRequires: {{ py2pkg('testtools') }}
Requires: %{name} = %{version}-%{release}
Requires: {{ py2pkg('kombu') }}
Requires: {{ py2pkg('mock') }}
Requires: {{ py2pkg('oslotest') }}
Requires: {{ py2pkg('testrepository') }}
Requires: {{ py2pkg('testresources') }}
Requires: {{ py2pkg('testscenarios') }}
Requires: {{ py2pkg('testtools') }}
Requires: {{ py3('kombu') }}
Requires: {{ py3('mock') }}
Requires: {{ py3('oslotest') }}
Requires: {{ py3('testrepository') }}
Requires: {{ py3('testresources') }}
Requires: {{ py3('testscenarios') }}
Requires: {{ py3('testtools') }}
%description test
The testsuite for the VMware vSphere ML2 drivers for OpenStack Neutron
@ -108,27 +110,27 @@ The testsuite for the VMware vSphere ML2 drivers for OpenStack Neutron
%py_req_cleanup
%build
%{py2_build}
python2 setup.py build_sphinx
%{py3_build}
PYTHONPATH=. PBR_VERSION={{ upstream_version }} %sphinx_build -b html doc/source doc/build/html
# remove the sphinx-build leftovers
rm -rf doc/build/html/.{doctrees,buildinfo}
%install
%{py2_install}
%{py3_install}
mv %{buildroot}%{_prefix}%{_sysconfdir} %{buildroot}%{_sysconfdir}
install -p -D -m 644 %{SOURCE1} %{buildroot}%{_unitdir}/openstack-neutron-dvs-agent.service
install -p -D -m 644 %{SOURCE2} %{buildroot}%{_unitdir}/openstack-neutron-ovsvapp-agent.service
install -p -D -m 644 %{SOURCE3} %{buildroot}%{_unitdir}/openstack-neutron-ovsvapp-agent-monitor.service
chmod +x %{buildroot}%{python2_sitelib}/networking_vsphere/monitor/ovsvapp-agent-monitor.sh
chmod +x %{buildroot}%{python3_sitelib}/networking_vsphere/monitor/ovsvapp-agent-monitor.sh
# Copy the drivers provided from python-networking-vsphere for
# Nova. Apparently VMWare drivers are out of the Nova tree, and
# maintained outside Nova, so we need to copy the provided driver.
mkdir -p %{buildroot}%{python2_sitelib}/nova/virt/vmwareapi/
cp -a %{buildroot}%{python2_sitelib}/networking_vsphere/nova/virt/vmwareapi/ovsvapp_vc_driver.py* \
%{buildroot}%{python2_sitelib}/nova/virt/vmwareapi/
cp -a %{buildroot}%{python2_sitelib}/networking_vsphere/nova/virt/vmwareapi/ovsvapp_vmops.py* \
%{buildroot}%{python2_sitelib}/nova/virt/vmwareapi/
%fdupes %{buildroot}%{python2_sitelib}
mkdir -p %{buildroot}%{python3_sitelib}/nova/virt/vmwareapi/
cp -a %{buildroot}%{python3_sitelib}/networking_vsphere/nova/virt/vmwareapi/ovsvapp_vc_driver.py* \
%{buildroot}%{python3_sitelib}/nova/virt/vmwareapi/
cp -a %{buildroot}%{python3_sitelib}/networking_vsphere/nova/virt/vmwareapi/ovsvapp_vmops.py* \
%{buildroot}%{python3_sitelib}/nova/virt/vmwareapi/
%fdupes %{buildroot}%{python3_sitelib}
# %check
# python2 setup.py testr
@ -165,14 +167,14 @@ cp -a %{buildroot}%{python2_sitelib}/networking_vsphere/nova/virt/vmwareapi/ovsv
%{_bindir}/ovsvapp-manage-dvpg
%{_bindir}/ovsvapp-manage-dvs
%files -n python-{{ pypi_name }}
%files -n python3-{{ pypi_name }}
%doc README.rst
%license LICENSE
%{python2_sitelib}/networking_vsphere
%{python2_sitelib}/networking_vsphere-*.egg-info
%{python2_sitelib}/nova/virt/vmwareapi/*
%{python3_sitelib}/networking_vsphere
%{python3_sitelib}/networking_vsphere-*.egg-info
%{python3_sitelib}/nova/virt/vmwareapi/*
# Part of test subpackage
%exclude %{python2_sitelib}/networking_vsphere/tests
%exclude %{python3_sitelib}/networking_vsphere/tests
%files dvs-agent
%{_unitdir}/openstack-neutron-dvs-agent.service
@ -190,7 +192,7 @@ cp -a %{buildroot}%{python2_sitelib}/networking_vsphere/nova/virt/vmwareapi/ovsv
%doc doc/build/html
%files test
%{python2_sitelib}/networking_vsphere/tests
%{python3_sitelib}/networking_vsphere/tests
%changelog