Accepting request 419455 from home:TheBlackCat:branches:devel:languages:python

Fix update-alternatives implementation

OBS-URL: https://build.opensuse.org/request/show/419455
OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-jsonpointer?expand=0&rev=15
This commit is contained in:
Todd R 2016-08-15 15:52:22 +00:00 committed by Git OBS Bridge
parent e20db782e3
commit 8f667aa9e5
2 changed files with 17 additions and 12 deletions

View File

@ -1,3 +1,8 @@
-------------------------------------------------------------------
Mon Aug 15 14:51:56 UTC 2016 - toddrme2178@gmail.com
- Fix update-alternatives implementation.
-------------------------------------------------------------------
Mon Jun 22 14:49:05 UTC 2015 - tbechtold@suse.com

View File

@ -19,16 +19,15 @@
Name: python-jsonpointer
Version: 1.9
Release: 0
Summary: Identify specific nodes in a JSON document (according to draft 08)
Summary: Identify specific nodes in a JSON document
License: BSD-3-Clause
Group: Development/Languages/Python
Url: https://github.com/stefankoegl/python-json-pointer
Source: http://pypi.python.org/packages/source/j/jsonpointer/jsonpointer-%{version}.tar.gz
BuildRequires: python-devel
BuildRequires: python-setuptools
Requires(post): update-alternatives
Requires(postun): update-alternatives
Requires(pre): coreutils
Requires(post): update-alternatives
Requires(preun): 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()")}
@ -47,25 +46,26 @@ python setup.py build
%install
python setup.py install --prefix=%{_prefix} --root=%{buildroot}
mv %{buildroot}%{_bindir}/jsonpointer %{buildroot}%{_bindir}/jsonpointer-%{py_ver}
ln -s %{_bindir}/jsonpointer-%{py_ver} %{buildroot}%{_bindir}/jsonpointer
%pre
[ -h %{_bindir}/jsonpointer ] || rm -f %{_bindir}/jsonpointer
# Prepare for update-alternatives usage
mkdir -p %{buildroot}%{_sysconfdir}/alternatives
mv %{buildroot}%{_bindir}/jsonpointer %{buildroot}%{_bindir}/jsonpointer-%{py_ver}
ln -s -f %{_sysconfdir}/alternatives/jsonpointer %{buildroot}%{_bindir}/jsonpointer
%post
update-alternatives --install \
%{_bindir}/jsonpointer jsonpointer %{_bindir}/jsonpointer-%{py_ver} 20
%_sbindir/update-alternatives \
--install %{_bindir}/jsonpointer jsonpointer %{_bindir}/jsonpointer-%{py_ver} 20
%preun
if [ $1 -eq 0 ] ; then
update-alternatives --remove jsonpointer %{_bindir}/jsonpointer-%{py_ver}
%_sbindir/update-alternatives --remove jsonpointer %{_bindir}/jsonpointer-%{py_ver}
fi
%files
%defattr(-,root,root,-)
%ghost %{_bindir}/jsonpointer
%{_bindir}/jsonpointer
%{_bindir}/jsonpointer-%{py_ver}
%ghost %{_sysconfdir}/alternatives/jsonpointer
%{python_sitelib}/*
%changelog