Accepting request 204054 from home:luca_b:branches:KDE:Qt

- Use alternatives for /usr/bin/sip to prevent conflicts between
  Python 3 and Python 2 python-sip-devel packages

OBS-URL: https://build.opensuse.org/request/show/204054
OBS-URL: https://build.opensuse.org/package/show/KDE:Qt/python-sip?expand=0&rev=111
This commit is contained in:
Dirk Mueller 2013-10-21 09:18:40 +00:00 committed by Git OBS Bridge
parent bf92c5e3f4
commit 4ef7b1cbb1
4 changed files with 50 additions and 2 deletions

View File

@ -1,3 +1,9 @@
-------------------------------------------------------------------
Sun Oct 20 07:42:07 UTC 2013 - lbeltrame@kde.org
- Use alternatives for /usr/bin/sip to prevent conflicts between
Python 3 and Python 2 python-sip-devel packages
-------------------------------------------------------------------
Thu Oct 17 12:41:50 UTC 2013 - toddrme2178@gmail.com

View File

@ -50,6 +50,7 @@ Group: Development/Libraries/Python
Requires: %{name} = %{version}
Requires: c++_compiler
Requires: python-devel
Requires(post): update-alternatives
Provides: python-sip-bin = %{version}
Obsoletes: python-sip-bin < %{version}
@ -86,13 +87,28 @@ echo "%%requires_python_sip_api Requires: python-sip(api) = $sip_major.$sip_mino
%install
make DESTDIR=%{buildroot} install
mkdir -p %{buildroot}%{_datadir}/sip
# For alternatives
mv %{buildroot}%{_bindir}/sip %{buildroot}%{_bindir}/sip-%{py_ver}
mkdir -p %{buildroot}%{_sysconfdir}/alternatives
touch %{buildroot}%{_sysconfdir}/alternatives/sip
ln -s -f %{_sysconfdir}/alternatives/sip %{buildroot}/%{_bindir}/sip
install -m 644 -D macros.%name %{buildroot}/%{_sysconfdir}/rpm/macros.%name
# Point to the correct location for the documentation files
sed -i 's/"doc" directory/"doc" directory of package %{name}-devel/' README
%post devel
update-alternatives --install %{_bindir}/sip sip %{_bindir}/sip-%{py_ver} 50
%preun devel
if ["$1" = 0] ; then
update-alternatives --remove sip %{_bindir}/sip-%{py_ver}
fi
%files
%defattr(-,root,root,-)
%doc README
@ -102,6 +118,8 @@ sed -i 's/"doc" directory/"doc" directory of package %{name}-devel/' README
%defattr(-,root,root,-)
%doc NEWS LICENSE* doc/
%config %{_sysconfdir}/rpm/macros.%name
%{_bindir}/sip-%{py_ver}
%ghost %{_sysconfdir}/alternatives/sip
%{_bindir}/sip
%{py_incdir}/sip.h
%{py_sitedir}/sipconfig.py

View File

@ -1,3 +1,9 @@
-------------------------------------------------------------------
Sun Oct 20 07:42:54 UTC 2013 - lbeltrame@kde.org
- Use alternatives for /usr/bin/sip to prevent conflicts between
Python 3 and Python 2 python-sip-devel packages
-------------------------------------------------------------------
Thu Oct 17 12:41:50 UTC 2013 - toddrme2178@gmail.com

View File

@ -53,6 +53,7 @@ Group: Development/Libraries/Python
Requires: %{name} = %{version}
Requires: c++_compiler
Requires: python3-devel
Requires(post): update-alternatives
Provides: python3-sip-bin = %{version}
Obsoletes: python3-sip-bin < %{version}
@ -89,14 +90,29 @@ echo "%%requires_python3_sip_api Requires: python3-sip(api) = $sip_major.$sip_mi
%install
%{make_install}
mkdir -p %{buildroot}%{_datadir}/sip
# For alternatives
mv %{buildroot}%{_bindir}/sip %{buildroot}%{_bindir}/sip-%{py3_ver}
mkdir -p %{buildroot}%{_sysconfdir}/alternatives
touch %{buildroot}%{_sysconfdir}/alternatives/sip
ln -s -f %{_sysconfdir}/alternatives/sip %{buildroot}/%{_bindir}/sip
# Point to the correct location for the documentation files
sed -i 's/"doc" directory/"doc" directory of package %{name}-devel/' README
install -m 644 -D macros.%name %{buildroot}/%{_sysconfdir}/rpm/macros.%name
%post devel
# Lower priority than the python 2.x version for now
update-alternatives --install %{_bindir}/sip sip %{_bindir}/sip-%{py3_ver} 40
%preun devel
if ["$1" = 0] ; then
update-alternatives --remove sip %{_bindir}/sip-%{py3_ver}
fi
%files
%defattr(-,root,root,-)
%doc README
@ -106,6 +122,8 @@ install -m 644 -D macros.%name %{buildroot}/%{_sysconfdir}/rpm/macros.%name
%defattr(-,root,root,-)
%doc NEWS LICENSE* doc/
%config %{_sysconfdir}/rpm/macros.%name
%{_bindir}/sip-%{py3_ver}
%ghost %{_sysconfdir}/alternatives/sip
%{_bindir}/sip
%{py3_incdir}/sip.h
%{python3_sitearch}/sipconfig.py