forked from pool/python-invoke
Accepting request 248624 from home:TheBlackCat:branches:devel:languages:python
Implement update-alternatives OBS-URL: https://build.opensuse.org/request/show/248624 OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-invoke?expand=0&rev=3
This commit is contained in:
@@ -1,3 +1,8 @@
|
||||
-------------------------------------------------------------------
|
||||
Thu Sep 11 13:11:26 UTC 2014 - toddrme2178@gmail.com
|
||||
|
||||
- Implement update-alternatives
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Thu Sep 11 12:58:33 UTC 2014 - toddrme2178@gmail.com
|
||||
|
||||
|
@@ -25,6 +25,8 @@ Group: Development/Languages/Python
|
||||
Source: https://pypi.python.org/packages/source/i/invoke/invoke-%{version}.tar.gz
|
||||
BuildRequires: python-devel
|
||||
BuildRequires: python-setuptools
|
||||
Requires(post): update-alternatives
|
||||
Requires(postun): update-alternatives
|
||||
BuildRoot: %{_tmppath}/%{name}-%{version}-build
|
||||
%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()")}
|
||||
@@ -66,12 +68,35 @@ python setup.py build
|
||||
|
||||
%install
|
||||
python setup.py install --prefix=%{_prefix} --root=%{buildroot}
|
||||
mv %{buildroot}%{_bindir}/inv %{buildroot}%{_bindir}/inv-%{py_ver}
|
||||
mv %{buildroot}%{_bindir}/invoke %{buildroot}%{_bindir}/invoke-%{py_ver}
|
||||
ln -s %{_bindir}/inv-%{py_ver} %{buildroot}%{_bindir}/inv
|
||||
ln -s %{_bindir}/invoke-%{py_ver} %{buildroot}%{_bindir}/invoke
|
||||
|
||||
%pre
|
||||
# Since /usr/bin/* became ghosted to be used with update-alternatives, we have to get rid
|
||||
# of the old binary resulting from the non-update-alternativies-ified package:
|
||||
[[ ! -L %{_bindir}/inv ]] && rm -f %{_bindir}/inv
|
||||
[[ ! -L %{_bindir}/invoke ]] && rm -f %{_bindir}/invoke
|
||||
exit 0
|
||||
|
||||
%post
|
||||
update-alternatives \
|
||||
--install %{_bindir}/invoke invoke %{_bindir}/invoke-%{py_ver} 30 \
|
||||
--slave %{_bindir}/inv inv %{_bindir}/inv%{py_ver} \
|
||||
|
||||
%preun
|
||||
if [ $1 -eq 0 ] ; then
|
||||
update-alternatives --remove invoke %{_bindir}/invoke-%{py_ver}
|
||||
fi
|
||||
|
||||
%files
|
||||
%defattr(-,root,root,-)
|
||||
%doc LICENSE README.rst
|
||||
%{_bindir}/inv
|
||||
%{_bindir}/invoke
|
||||
%{_bindir}/inv-%{py_ver}
|
||||
%{_bindir}/invoke-%{py_ver}
|
||||
%ghost %{_bindir}/inv
|
||||
%ghost %{_bindir}/invoke
|
||||
%{python_sitelib}/*
|
||||
|
||||
%changelog
|
||||
%changelog
|
||||
|
Reference in New Issue
Block a user