Fix update-alternatives implementation. OBS-URL: https://build.opensuse.org/request/show/419498 OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-jsonpatch?expand=0&rev=21
80 lines
2.6 KiB
RPMSpec
80 lines
2.6 KiB
RPMSpec
#
|
|
# spec file for package python-jsonpatch
|
|
#
|
|
# Copyright (c) 2015 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
|
|
# upon. The license for this file, and modifications and additions to the
|
|
# file, is the same license as for the pristine package itself (unless the
|
|
# license for the pristine package is not an Open Source License, in which
|
|
# case the license is the MIT License). An "Open Source License" is a
|
|
# license that conforms to the Open Source Definition (Version 1.9)
|
|
# published by the Open Source Initiative.
|
|
|
|
# Please submit bugfixes or comments via http://bugs.opensuse.org/
|
|
#
|
|
|
|
|
|
Name: python-jsonpatch
|
|
Version: 1.11
|
|
Release: 0
|
|
Summary: Python - JSON-Patches
|
|
License: BSD-3-Clause
|
|
Group: Development/Languages/Python
|
|
Url: https://github.com/stefankoegl/python-json-patch
|
|
Source: http://pypi.python.org/packages/source/j/jsonpatch/jsonpatch-%{version}.tar.gz
|
|
BuildRequires: python-devel
|
|
BuildRequires: python-jsonpointer
|
|
Requires: python-jsonpointer >= 1.9
|
|
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()")}
|
|
%else
|
|
BuildArch: noarch
|
|
%endif
|
|
|
|
%description
|
|
Python module to apply JSON-Patches (according to RFC 6902).
|
|
|
|
%prep
|
|
%setup -q -n jsonpatch-%{version}
|
|
sed -i "s|entry_poimts|entry_points|" setup.py # Typo fix already in upstream git..
|
|
|
|
%build
|
|
python setup.py build
|
|
|
|
%install
|
|
python setup.py install --prefix=%{_prefix} --root=%{buildroot}
|
|
|
|
# Prepare for update-alternatives usage
|
|
mkdir -p %{buildroot}%{_sysconfdir}/alternatives
|
|
for p in jsonpatch jsondiff ; do
|
|
mv %{buildroot}%{_bindir}/$p %{buildroot}%{_bindir}/$p-%{py_ver}
|
|
ln -s -f %{_sysconfdir}/alternatives/$p %{buildroot}%{_bindir}/$p
|
|
done
|
|
|
|
%post
|
|
%_sbindir/update-alternatives \
|
|
--install %{_bindir}/jsonpatch jsonpatch %{_bindir}/jsonpatch-%{py_ver} 20 \
|
|
--slave %{_bindir}/jsondiff jsondiff %{_bindir}/jsondiff-%{py_ver}
|
|
|
|
%preun
|
|
if [ $1 -eq 0 ] ; then
|
|
%_sbindir/update-alternatives --remove jsonpatch %{_bindir}/jsonpatch-%{py_ver}
|
|
fi
|
|
|
|
%files
|
|
%defattr(-,root,root,-)
|
|
%{_bindir}/jsondiff
|
|
%{_bindir}/jsonpatch
|
|
%{_bindir}/jsondiff-%{py_ver}
|
|
%{_bindir}/jsonpatch-%{py_ver}
|
|
%ghost %{_sysconfdir}/alternatives/jsondiff
|
|
%ghost %{_sysconfdir}/alternatives/jsonpatch
|
|
%{python_sitelib}/jsonpatch*
|
|
|
|
%changelog
|