File python-python-subunit.spec of Package python-python-subunit
#
# spec file for package python-python-subunit
#
# Copyright (c) 2014 SUSE LINUX Products GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
# Please submit bugfixes or comments via http://bugs.opensuse.org/
#
Name: python-python-subunit
Version: 0.0.21
Release: 0
Summary: Python implementation of subunit test streaming protocol
License: Apache-2.0 or BSD-3-Clause
Group: Development/Languages/Python
Url: http://launchpad.net/subunit
Source: http://pypi.python.org/packages/source/p/python-subunit/python-subunit-%{version}.tar.gz
# PATCH-FIX-OPENSUSE speilicke@suse.com -- Filters are installed in /usr/bin.
Patch0: python-subunit-filter-path.patch
BuildRequires: python-devel
# Test requriements
BuildRequires: python-testscenarios
BuildRequires: python-testtools >= 0.9.34
Requires: python-extras
Requires: python-testtools >= 0.9.34
Requires(post): update-alternatives
Requires(postun): update-alternatives
BuildRoot: %{_tmppath}/%{name}-%{version}-build
%if 0%{?suse_version} && 0%{?suse_version} <= 1110
%{!?python_sitelib: %global python_sitelib %(python -c "from distutils.sysconfig import get_python_lib; print get_python_lib()")}
%else
BuildArch: noarch
%endif
%description
Subunit is a streaming protocol for test results. The protocol is human
readable and easily generated and parsed. By design all the components of
the protocol conceptually fit into the xUnit TestCase->TestResult interaction.
Subunit comes with command line filters to process a subunit stream and
language bindings for python, C, C++ and shell. Bindings are easy to write
for other languages.
%prep
%setup -q -n python-subunit-%{version}
%patch0 -p1
for B in subunit2csv subunit-2to1 subunit-1to2 subunit-filter subunit-ls subunit-notify subunit-stats subunit-tags subunit-output subunit2gtk subunit2junitxml subunit2pyunit tap2subunit ; do
sed -i "s|'filters/$B'|'filters/$B-%{py_ver}'|" setup.py
mv filters/$B filters/$B-%{py_ver}
done
sed -i "s|'subunit-filter'|'subunit-filter-%{py_ver}'|" python/subunit/tests/test_subunit_filter.py
%build
python setup.py build
%install
python setup.py install --prefix=%{_prefix} --root=%{buildroot}
#NOTE(saschpe): The testsuite demands executables:
chmod +x %{buildroot}%{python_sitelib}/subunit/tests/sample-*.py
mkdir -p %{buildroot}%{_sysconfdir}/alternatives
for B in subunit2csv subunit-2to1 subunit-1to2 subunit-filter subunit-ls subunit-notify subunit-stats subunit-tags subunit-output subunit2gtk subunit2junitxml subunit2pyunit tap2subunit ; do
touch %{buildroot}%{_sysconfdir}/alternatives/$B
ln -sf %{_sysconfdir}/alternatives/$B %{buildroot}/%{_bindir}/$B
done
%check
##NOTE(saschpe): Pesky testsuite doesn't know about buildroot
#sed -i "s|'/',|'%{buildroot}',|" %{buildroot}%{python_sitelib}/subunit/tests/test_subunit_filter.py
#PYTHONPATH=%{buildroot}%{python_sitelib} python -m testtools.run subunit.test_suite
#sed -i "s|'%{buildroot}',|'/',|" %{buildroot}%{python_sitelib}/subunit/tests/test_subunit_filter.py
## Fixup compiled python module afterwards:
#%py_compile %{buildroot}%{python_sitelib}/subunit/tests
%post
update-alternatives \
--install %{_bindir}/subunit-2to1 subunit-2to1 %{_bindir}/subunit-2to1-%{py_ver} 20 \
--slave %{_bindir}/subunit-1to2 subunit-1to2 %{_bindir}/subunit-1to2-%{py_ver} \
--slave %{_bindir}/subunit2csv subunit2csv %{_bindir}/subunit2csv-%{py_ver} \
--slave %{_bindir}/subunit-filter subunit-filter %{_bindir}/subunit-filter-%{py_ver} \
--slave %{_bindir}/subunit-ls subunit-ls %{_bindir}/subunit-ls-%{py_ver} \
--slave %{_bindir}/subunit-notify subunit-notify %{_bindir}/subunit-notify-%{py_ver} \
--slave %{_bindir}/subunit-stats subunit-stats %{_bindir}/subunit-stats-%{py_ver} \
--slave %{_bindir}/subunit-tags subunit-tags %{_bindir}/subunit-tags-%{py_ver} \
--slave %{_bindir}/subunit-output subunit-output %{_bindir}/subunit-output-%{py_ver} \
--slave %{_bindir}/subunit2gtk subunit2gtk %{_bindir}/subunit2gtk-%{py_ver} \
--slave %{_bindir}/subunit2junitxml subunit2junitxml %{_bindir}/subunit2junitxml-%{py_ver} \
--slave %{_bindir}/subunit2pyunit subunit2pyunit %{_bindir}/subunit2pyunit-%{py_ver} \
--slave %{_bindir}/tap2subunit tap2subunit %{_bindir}/tap2subunit-%{py_ver}
%postun
if [ $1 -eq 0 ] ; then
update-alternatives --remove subunit %{_bindir}/subunit-%{py_ver}
fi
%files
%defattr(-,root,root,-)
%doc README NEWS
%{_bindir}/subunit2csv
%{_bindir}/subunit2csv-%{py_ver}
%{_bindir}/subunit-2to1
%{_bindir}/subunit-2to1-%{py_ver}
%{_bindir}/subunit-1to2
%{_bindir}/subunit-1to2-%{py_ver}
%{_bindir}/subunit-filter
%{_bindir}/subunit-filter-%{py_ver}
%{_bindir}/subunit-ls
%{_bindir}/subunit-ls-%{py_ver}
%{_bindir}/subunit-notify
%{_bindir}/subunit-notify-%{py_ver}
%{_bindir}/subunit-stats
%{_bindir}/subunit-stats-%{py_ver}
%{_bindir}/subunit-tags
%{_bindir}/subunit-tags-%{py_ver}
%{_bindir}/subunit-output
%{_bindir}/subunit-output-%{py_ver}
%{_bindir}/subunit2gtk
%{_bindir}/subunit2gtk-%{py_ver}
%{_bindir}/subunit2junitxml
%{_bindir}/subunit2junitxml-%{py_ver}
%{_bindir}/subunit2pyunit
%{_bindir}/subunit2pyunit-%{py_ver}
%{_bindir}/tap2subunit
%{_bindir}/tap2subunit-%{py_ver}
%ghost %{_sysconfdir}/alternatives/subunit2csv
%ghost %{_sysconfdir}/alternatives/subunit-2to1
%ghost %{_sysconfdir}/alternatives/subunit-1to2
%ghost %{_sysconfdir}/alternatives/subunit-filter
%ghost %{_sysconfdir}/alternatives/subunit-ls
%ghost %{_sysconfdir}/alternatives/subunit-notify
%ghost %{_sysconfdir}/alternatives/subunit-stats
%ghost %{_sysconfdir}/alternatives/subunit-tags
%ghost %{_sysconfdir}/alternatives/subunit-output
%ghost %{_sysconfdir}/alternatives/subunit2gtk
%ghost %{_sysconfdir}/alternatives/subunit2junitxml
%ghost %{_sysconfdir}/alternatives/subunit2pyunit
%ghost %{_sysconfdir}/alternatives/tap2subunit
%{python_sitelib}/subunit
%{python_sitelib}/python_subunit-%{version}-py%{py_ver}.egg-info
%changelog