File python-reno.spec of Package python-reno

#
# spec file for package python-reno
#
# Copyright (c) 2016 SUSE LINUX 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-reno
Version:        1.8.0
Release:        0
Summary:        RElease NOtes manager
License:        Apache-2.0
Group:          Development/Languages/Python
Url:            http://www.openstack.org/
Source:         https://pypi.io/packages/source/r/reno/reno-%{version}.tar.gz
BuildRequires:  python-Babel
BuildRequires:  python-PyYAML
BuildRequires:  python-devel
BuildRequires:  python-pbr
BuildRequires:  python-setuptools
%if %{with tests}
BuildRequires:  python-testrepository
BuildRequires:  python-testscenarios
BuildRequires:  python-testtools
%endif
Requires:       python-Babel >= 1.3
Requires:       python-PyYAML >= 3.1.0
%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
Reno is a release notes manager for storing release notes in a git
repository and then building documentation from them.

%prep
%setup -q -n reno-%{version}

%build
python setup.py build

%install
python setup.py install --prefix=%{_prefix} --root=%{buildroot}

%if %{with tests}
%check
python setup.py test
%endif

# Prepare for update-alternatives usage
mkdir -p %{buildroot}%{_sysconfdir}/alternatives
for p in reno ; do
    mv %{buildroot}%{_bindir}/$p %{buildroot}%{_bindir}/$p-%{py_ver}
    ln -s -f %{_sysconfdir}/alternatives/$p %{buildroot}%{_bindir}/$p
    # create a dummy target for /etc/alternatives/$p
    touch %{buildroot}%{_sysconfdir}/alternatives/$p
done

%post
%_sbindir/update-alternatives \
   --install %{_bindir}/reno reno %{_bindir}/reno-%{py_ver} 30

%postun
if [ $1 -eq 0 ] ; then
    %_sbindir/update-alternatives --remove reno %{_bindir}/reno-%{py_ver}
fi

%files
%defattr(-,root,root,-)
%doc LICENSE ChangeLog README.rst AUTHORS
%{_bindir}/reno
%{_bindir}/reno-%{py_ver}
%ghost %{_sysconfdir}/alternatives/reno
%{python_sitelib}/reno
%{python_sitelib}/*.egg-info

%changelog
openSUSE Build Service is sponsored by