diff --git a/python-xattr.spec b/python-xattr.spec index f39f6d6..a3c7d84 100644 --- a/python-xattr.spec +++ b/python-xattr.spec @@ -1,7 +1,7 @@ # # spec file for package python-xattr # -# Copyright (c) 2015 SUSE LINUX GmbH, Nuernberg, Germany. +# 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 @@ -27,7 +27,12 @@ Source: https://github.com/xattr/xattr/archive/v%{version}.tar.gz BuildRequires: python-cffi BuildRequires: python-devel BuildRequires: python-setuptools +%if 0%{?suse_version} && 0%{?suse_version} <= 1310 +BuildRequires: update-alternatives +%endif %requires_eq python-cffi +Requires(post): update-alternatives +Requires(postun): update-alternatives BuildRoot: %{_tmppath}/%{name}-%{version}-build Provides: pyxattr = %{version} Obsoletes: pyxattr < %{version} @@ -52,12 +57,30 @@ python setup.py build %install python setup.py install --prefix=%{_prefix} --root=%{buildroot} +mv %{buildroot}%{_bindir}/xattr %{buildroot}%{_bindir}/xattr-%{py_ver} + +%if 0%{?suse_version} && 0%{?suse_version} > 1310 +mkdir -p %{buildroot}%{_sysconfdir}/alternatives +ln -s -f %{_sysconfdir}/alternatives/xattr %{buildroot}%{_bindir}/xattr +%endif + +%post +%{_sbindir}/update-alternatives \ + --install %_bindir/xattr xattr %_bindir/xattr-%{py_ver} 10 + +%preun +%{_sbindir}/update-alternatives \ + --remove xattr %_bindir/xattr %files %defattr(-,root,root) %doc README.txt -%{_bindir}/xattr +%{_bindir}/xattr-%{py_ver} %{python_sitelib}/xattr %{python_sitelib}/xattr-*egg-info +%if 0%{?suse_version} && 0%{?suse_version} > 1310 +%{_bindir}/xattr +%ghost %_sysconfdir/alternatives/xattr +%endif %changelog