File python-bumpversion.spec of Package python-bumpversion

#
# spec file for package python-bumpversion
#
# Copyright (c) 2015 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-bumpversion
Version:        0.5.3
Release:        0
Summary:        Version-bump your software with a single command
License:        MIT
Group:          Development/Languages/Python
Url:            https://github.com/peritus/bumpversion
Source:         https://pypi.python.org/packages/source/b/bumpversion/bumpversion-%{version}.tar.gz
BuildRequires:  python-devel
BuildRequires:  python-setuptools
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
Requires(post): update-alternatives
Requires(postun): update-alternatives
%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
Version-bump your software with a single command!

bumpversion updates all version strings in your source tree by the correct
increment, commits that change to git or Mercurial and tags it.

%prep
%setup -q -n bumpversion-%{version}
sed -i "s|'bumpversion =|'bumpversion-%{py_ver} =|" setup.py

%build
python setup.py build

%install
python setup.py install --prefix=%{_prefix} --root=%{buildroot}
ln -s %{_bindir}/bumpversion-%{py_ver} %{buildroot}%{_bindir}/bumpversion

%post
update-alternatives --install %{_bindir}/bumpversion bumpversion %{_bindir}/bumpversion-%{py_ver} 20

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

%files
%defattr(-,root,root,-)
%doc README.rst
%ghost %{_bindir}/bumpversion
%{_bindir}/bumpversion-%{py_ver}
%{python_sitelib}/bumpversion*
%if 0%{?suse_version} >= 1230
%ghost %{_sysconfdir}/alternatives/bumpversion
%endif

%changelog
openSUSE Build Service is sponsored by