From 72ffe75e2f4ab141c4f7369f19b8b6b3d69af31ff1bbd7f4450fdcf45bfb8085 Mon Sep 17 00:00:00 2001 From: Matej Cepl Date: Fri, 17 Sep 2021 21:26:07 +0000 Subject: [PATCH] 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 --- python-numpy.changes | 5 +++++ python-numpy.spec | 37 +++++++++++++++++++++++++++++++++++-- 2 files changed, 40 insertions(+), 2 deletions(-) diff --git a/python-numpy.changes b/python-numpy.changes index c474002..18543d9 100644 --- a/python-numpy.changes +++ b/python-numpy.changes @@ -1,3 +1,8 @@ +------------------------------------------------------------------- +Sun Aug 22 16:28:30 UTC 2021 - Stefan Schubert + +- Use libalternatives instead of update-alternatives. + ------------------------------------------------------------------- Fri Jul 16 15:14:36 UTC 2021 - Ben Greiner diff --git a/python-numpy.spec b/python-numpy.spec index e6b4aff..1fe6b38 100644 --- a/python-numpy.spec +++ b/python-numpy.spec @@ -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