stackviz: convert to python3

Also enable unit tests.

Change-Id: I69f2ffdc60c96690167776783b182ad9afc17b94
This commit is contained in:
Javier Pena 2020-01-16 19:35:11 +01:00 committed by Javier Peña
parent 308e5753da
commit fa8cc044ea

View File

@ -6,7 +6,7 @@
A visualization utility to help analyze the performance of \
DevStack setup and Tempest executions
%global with_doc 1
%global with_tests 0
%global with_tests 1
Name: {{ py2name() }}
Version: {{ py2rpmversion() }}
Release: {{ py2rpmrelease() }}
@ -15,39 +15,43 @@ License: {{ license('Apache-2.0') }}
URL: http://git.openstack.org/cgit/openstack/stackviz
Source0: {{ source|basename }}
BuildRequires: openstack-macros
BuildRequires: {{ py2pkg('devel', py_versions=['py2', 'py3']) }}
BuildRequires: {{ py2pkg('python-subunit', py_versions=['py2', 'py3']) }}
BuildRequires: {{ py2pkg('testrepository', py_versions=['py2', 'py3']) }}
BuildRequires: {{ py2pkg('testtools', py_versions=['py2', 'py3']) }}
Requires: {{ py2pkg('python-subunit') }}
Requires: {{ py2pkg('testrepository') }}
Requires: {{ py2pkg('testtools') }}
BuildRequires: {{ py3('devel') }}
BuildRequires: {{ py3('oslotest') }}
BuildRequires: {{ py3('python-subunit') }}
BuildRequires: {{ py3('stestr') }}
BuildRequires: {{ py3('testrepository') }}
BuildRequires: {{ py3('testtools') }}
BuildArch: noarch
%if 0%{?rdo}
BuildRequires: {{ py2pkg('subunit2sql') }}
Requires: {{ py2pkg('subunit2sql') }}
Requires: {{ py3('subunit2sql') }}
%endif
%if 0%{?with_tests}
BuildRequires: {{ py2pkg('docutils', py_versions=['py2', 'py3']) }}
BuildRequires: {{ py3('docutils') }}
%endif
%if 0%{?suse_version}
Requires(post): update-alternatives
Requires(postun): update-alternatives
%else
# on RDO, update-alternatives is in chkconfig
Requires(post): chkconfig
Requires(postun): chkconfig
%endif
%python_subpackages
%description
%{common_desc}
%package -n {{ py2name(py_versions='py3') }}
Summary: Visualization utility
Requires: {{ py3('python-subunit') }}
Requires: {{ py3('six') }}
Requires: {{ py3('testrepository') }}
Requires: {{ py3('testtools') }}
%if 0%{?rdo}
Requires: {{ py3('subunit2sql') }}
%endif
%description -n {{ py2name(py_versions='py3') }}
%{common_desc}
This package contains the Python 3.x module.
%if 0%{?with_doc}
%package -n python-stackviz-doc
Summary: Documentation for stackviz
BuildRequires: {{ py2pkg('Sphinx') }}
BuildRequires: {{ py2pkg('openstackdocstheme') }}
BuildRequires: {{ py3('Sphinx') }}
BuildRequires: {{ py3('openstackdocstheme') }}
%description -n python-stackviz-doc
It contains the documentation for the stackviz.
@ -57,43 +61,34 @@ It contains the documentation for the stackviz.
%prep
%autosetup -n {{ pypi_name }}-{{ upstream_version }}
%py_req_cleanup
# Remove bundled egg-info
rm -rf %{module}.egg-info
%build
%{python_build}
%{py3_build}
# Generate Docs
%if 0%{?with_doc}
export PYTHONPATH="$( pwd ):$PYTHONPATH"
PBR_VERSION={{ upstream_version }} sphinx-build -b html doc/source doc/build/html
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}
%endif
%install
%{python_install}
%python_clone -a %{buildroot}%{_bindir}/stackviz-export
%{py3_install}
%if 0%{?with_tests}
%check
export OS_TEST_PATH=./stackviz/tests
export PYTHONPATH=.
%{__python2} setup.py test
python3 -m stestr.cli run
%endif
%post
%python_install_alternative stackviz-export
%postun
%python_uninstall_alternative stackviz-export
%files %{python_files}
%files -n {{ py2name(py_versions='py3') }}
%license LICENSE
%python_alternative %{_bindir}/stackviz-export
%{python_sitelib}/stackviz
%{python_sitelib}/stackviz-*.egg-info
%{_bindir}/stackviz-export
%{python3_sitelib}/stackviz
%{python3_sitelib}/stackviz-*.egg-info
%if 0%{?with_doc}
%files -n python-stackviz-doc