15
0
forked from pool/python-json5

Accepting request 919838 from home:schubi2

- Use libalternatives instead of update-alternatives.

OBS-URL: https://build.opensuse.org/request/show/919838
OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-json5?expand=0&rev=9
This commit is contained in:
2021-09-17 20:43:30 +00:00
committed by Git OBS Bridge
parent cc597acad7
commit c931021909
2 changed files with 41 additions and 1 deletions

View File

@@ -1,3 +1,8 @@
-------------------------------------------------------------------
Thu Sep 9 11:01:05 UTC 2021 - Stefan Schubert <schubi@suse.de>
- Use libalternatives instead of update-alternatives.
-------------------------------------------------------------------
Tue Jun 22 08:52:38 UTC 2021 - Paolo Stivanin <info@paolostivanin.com>

View File

@@ -16,6 +16,13 @@
#
#
%if 0%{?suse_version} > 1500
%bcond_without libalternatives
%else
%bcond_with libalternatives
%endif
%{?!python_module:%define python_module() python-%{**} python3-%{**}}
Name: python-json5
Version: 0.9.6
@@ -30,8 +37,12 @@ BuildRequires: %{python_module setuptools}
BuildRequires: fdupes
BuildRequires: python-rpm-macros
Requires: python-setuptools
%if %{with libalternatives}
Requires: alts
%else
Requires(post): update-alternatives
Requires(postun):update-alternatives
%endif
BuildArch: noarch
%python_subpackages
@@ -54,23 +65,47 @@ slightly more usable as a configuration language:
%install
%python_install
%python_clone -a %{buildroot}%{_bindir}/pyjson5
%if ! %{with libalternatives}
%python_clone -a %{buildroot}%{_bindir}/pyjson5
%else
%python_clone %{buildroot}%{_bindir}/pyjson5
ln -sf %{_bindir}/alts %{buildroot}%{_bindir}/pyjson5
mkdir -p %{buildroot}%{_datadir}/libalternatives/pyjson5
%python_expand content="binary=%{_bindir}/pyjson5-%{$python_version}"
%python_expand echo -e $content > %{buildroot}%{_datadir}/libalternatives/pyjson5/10%{$python_version_nodots}.conf
%endif
%python_expand rm -rf %{buildroot}%{$python_sitelib}/tests
%python_expand %fdupes %{buildroot}%{$python_sitelib}
%check
%pytest
%if %{with libalternatives}
%pre
# removing old update-alternatives entries
if [ "$1" -gt 0 ] && [ -f %{_sbindir}/update-alternatives ] ; then
%python_uninstall_alternative pyjson5
fi
%else
%post
%python_install_alternative pyjson5
%postun
%python_uninstall_alternative pyjson5
%endif
%files %{python_files}
%doc README.md
%license LICENSE
%if ! 0%{with libalternatives}
%python_alternative %{_bindir}/pyjson5
%else
%dir %{_datadir}/libalternatives
%dir %{_datadir}/libalternatives/pyjson5
%{_datadir}/libalternatives/pyjson5/10%python_version_nodots.conf
%{_bindir}/pyjson5
%{_bindir}/pyjson5-%python_version
%endif
%{python_sitelib}/*
%changelog