Update pymod2pkg to 0.16.0

Switch to use stestr. Also converting it to singlespec by
incorporating the changes from
https://review.openstack.org/#/c/597062/

Change-Id: Ic942bc12320e1f8149d89dcd149896127b006df9
This commit is contained in:
Guang Yee
2018-11-08 10:04:15 -08:00
parent beb014f794
commit 8386f1ff7b

View File

@@ -1,59 +1,70 @@
%global sname pymod2pkg
Name: {{ py2name('pymod2pkg') }}
Version: 0.14.0
Release: 0
{% set pypi_name = 'pymod2pkg' %}
{% set upstream_version = upstream_version('0.16.0') %}
{% set rpm_release = '1' %}
{% set source = url_pypi() %}
Name: {{ py2name() }}
Version: {{ py2rpmversion() }}
Release: {{ py2rpmrelease() }}
Summary: OpenStack Packaging - python module name to package name map
License: {{ license('Apache-2.0') }}
Group: Development/Libraries/Python
URL: https://wiki.openstack.org/wiki/Rpm-packaging
Source0: https://files.pythonhosted.org/packages/source/p/%{sname}/%{sname}-%{version}.tar.gz
Source0: {{ source }}
BuildRequires: openstack-macros
BuildRequires: {{ py2pkg('devel') }}
BuildRequires: {{ py2pkg('pbr') }}
BuildRequires: {{ py2pkg('testrepository') }}
BuildRequires: {{ py2pkg('testscenarios') }}
BuildRequires: {{ py2pkg('testtools') }}
BuildRequires: {{ py2pkg('devel', py_versions=['py2', 'py3']) }}
BuildRequires: {{ py2pkg('pbr', py_versions=['py2', 'py3']) }}
BuildRequires: {{ py2pkg('stestr', py_versions=['py2', 'py3']) }}
BuildRequires: {{ py2pkg('testresources', py_versions=['py2', 'py3']) }}
BuildRequires: {{ py2pkg('testtools', py_versions=['py2', 'py3']) }}
Requires: {{ py2pkg('pbr') }}
BuildArch: noarch
%python_subpackages
%description
pymod2pkg is a simple python module for translating python module names to
corresponding package names which is a common problem in the packaging world.
%package doc
%package -n {{ py2name() }}-doc
Summary: Documentation for python module name to package name map library
BuildRequires: {{ py2pkg('Sphinx') }}
BuildRequires: {{ py2pkg('oslosphinx') }}
Requires: %{name} = %{version}
%description doc
%description -n {{ py2name() }}-doc
Documentation for python module name to package name map library.
%prep
%autosetup -n %{sname}-%{version}
%autosetup -p1 -n {{ pypi_name }}-{{ upstream_version }}
%py_req_cleanup
%build
%{py2_build}
%{python_build}
# generate html docs
%{__python2} setup.py build_sphinx
# remove the sphinx-build leftovers
rm -rf doc/build/html/.{doctrees,buildinfo}
%install
%{py2_install}
%{python_install}
%python_clone -a %{buildroot}%{_bindir}/pymod2pkg
%check
%{__python2} setup.py test
%python_exec -m stestr.cli run
%files
%post
%python_install_alternative pymod2pkg
%postun
%python_uninstall_alternative pymod2pkg
%files %{python_files}
%license LICENSE
%doc README*
%{_bindir}/pymod2pkg
%{python2_sitelib}/%{sname}*
%{python2_sitelib}/*.egg-info
%python_alternative %{_bindir}/pymod2pkg
%{python_sitelib}/*
%files doc
%files -n {{ py2name() }}-doc
%doc doc/build/html
%license LICENSE