diff --git a/python-sip.changes b/python-sip.changes index 1eefe63..95ed6c9 100644 --- a/python-sip.changes +++ b/python-sip.changes @@ -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 diff --git a/python-sip.spec b/python-sip.spec index a448ee1..3f79a90 100644 --- a/python-sip.spec +++ b/python-sip.spec @@ -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 diff --git a/python3-sip.changes b/python3-sip.changes index 873a0af..5d479d1 100644 --- a/python3-sip.changes +++ b/python3-sip.changes @@ -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 diff --git a/python3-sip.spec b/python3-sip.spec index ecd41ec..28081bd 100644 --- a/python3-sip.spec +++ b/python3-sip.spec @@ -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