forked from pool/python-xattr
Accepting request 398376 from home:sax2:branches:devel:languages:python
Added update-alternatives mechanism This is required to avoid conflicts with python3-xattr OBS-URL: https://build.opensuse.org/request/show/398376 OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-xattr?expand=0&rev=24
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user