Accepting request 919789 from home:schubi2

- Use libalternatives instead of update-alternatives.

OBS-URL: https://build.opensuse.org/request/show/919789
OBS-URL: https://build.opensuse.org/package/show/devel:languages:python:numeric/python-numpy?expand=0&rev=93
This commit is contained in:
Matej Cepl 2021-09-17 21:26:07 +00:00 committed by Git OBS Bridge
parent 696375d29d
commit 72ffe75e2f
2 changed files with 40 additions and 2 deletions

View File

@ -1,3 +1,8 @@
-------------------------------------------------------------------
Sun Aug 22 16:28:30 UTC 2021 - Stefan Schubert <schubi@suse.de>
- Use libalternatives instead of update-alternatives.
-------------------------------------------------------------------
Fri Jul 16 15:14:36 UTC 2021 - Ben Greiner <code@bnavigator.de>

View File

@ -1,5 +1,5 @@
#
# spec file
# spec file for package python-numpy
#
# Copyright (c) 2021 SUSE LLC
#
@ -16,6 +16,12 @@
#
%if 0%{?suse_version} > 1500
%bcond_without libalternatives
%else
%bcond_with libalternatives
%endif
%global flavor @BUILD_FLAVOR@%{nil}
%define ver 1.21.0
%define _ver 1_21_0
@ -119,9 +125,13 @@ BuildRequires: libopenblas%{?hpc_ext}-%{compiler_family}%{?c_f_ver}-hpc-devel
BuildRequires: lua-lmod
BuildRequires: suse-hpc
Requires: libopenblas%{?hpc_ext}-%{compiler_family}%{?c_f_ver}-hpc
%if %{with libalternatives}
Requires: alts
%else
Requires(post): update-alternatives
Requires(postun):update-alternatives
%endif
%endif
%python_subpackages
%description
@ -194,7 +204,14 @@ export CFLAGS="%{optflags} -fno-strict-aliasing"
%python_exec setup.py install --prefix=%{p_prefix} --root=%{buildroot}
%if !%{with hpc}
%python_clone -a %{buildroot}%{_bindir}/f2py
%if ! %{with libalternatives}
%python_clone -a %{buildroot}%{_bindir}/f2py
%else
%python_clone %{buildroot}%{_bindir}/f2py
ln -sf %{_bindir}/alts %{buildroot}%{_bindir}/f2py
mkdir -p %{buildroot}%{_datadir}/libalternatives/f2py
%python_expand echo "binary=%{_bindir}/f2py-%{$python_version}" > %{buildroot}%{_datadir}/libalternatives/f2py/10%{$python_version_nodots}.conf
%endif
%endif
%if 0%{?suse_version}
@ -283,17 +300,33 @@ popd
%endif
%if %{without hpc}
%if %{with libalternatives}
%pre
# removing old update-alternatives entries
if [ "$1" -gt 0 ] && [ -f %{_sbindir}/update-alternatives ] ; then
%python_uninstall_alternative f2py
fi
%else
%post
%python_install_alternative f2py
%postun
%python_uninstall_alternative f2py
%endif
%endif
%files %{python_files}
%doc README.md THANKS.txt
%if %{without hpc}
%if ! 0%{with libalternatives}
%python_alternative %{_bindir}/f2py
%else
%dir %{_datadir}/libalternatives
%dir %{_datadir}/libalternatives/f2py
%{_datadir}/libalternatives/f2py/10%python_version_nodots.conf
%{_bindir}/f2py
%{_bindir}/f2py-%python_version
%endif
%if "%{python_flavor}" == "python3" || "%{python_provides}" == "python3"
%{_bindir}/f2py3
%endif