Implement alternatives

This commit is contained in:
Tomáš Hrnčiar 2023-12-11 14:19:58 +01:00 committed by Miro Hrončok
parent 44967b6cba
commit 525ac53673
1 changed files with 25 additions and 0 deletions

View File

@ -69,6 +69,13 @@ Requires: python%{python3_pkgversion}-numpy%{?_isa} = %{version}-%{release
Requires: python%{python3_pkgversion}-devel
Provides: python%{python3_pkgversion}-f2py = %{version}-%{release}
# Require alternatives version that implements the --keep-foreign flag and fixes rhbz#2203820
Requires(postun): alternatives >= 1.19.2-1
# python3.12 installs the alternatives master symlink to which we attach a slave
Requires: python%{python3_pkgversion}
Requires(post): python%{python3_pkgversion}
Requires(postun): python%{python3_pkgversion}
%description -n python%{python3_pkgversion}-numpy-f2py
This package includes a version of f2py that works properly with NumPy.
@ -108,6 +115,10 @@ rm f2py
rm f2py3
popd &> /dev/null
# All ghost files controlled by alternatives need to exist for the files
# section check to succeed
touch %{buildroot}%{_bindir}/f2py3
# distutils from setuptools don't have the patch that was created to avoid standard runpath here
# we strip it manually instead
# ERROR 0001: file '...' contains a standard runpath '/usr/lib64' in [/usr/lib64]
@ -133,6 +144,19 @@ export PYTHONPATH=%{buildroot}%{python3_sitearch}
%endif
%post -n python%{python3_pkgversion}-numpy-f2py
alternatives --add-slave python3 %{_bindir}/python%{python3_version} \
%{_bindir}/f2py3 \
f2py3 \
%{_bindir}/f2py%{python3_version}
%postun -n python%{python3_pkgversion}-numpy-f2py
# Do this only during uninstall process (not during update)
if [ $1 -eq 0 ]; then
alternatives --keep-foreign --remove-slave python3 %{_bindir}/python%{python3_version} \
f2py3
fi
%files -n python%{python3_pkgversion}-numpy
%license LICENSE.txt
@ -165,6 +189,7 @@ export PYTHONPATH=%{buildroot}%{python3_sitearch}
%files -n python%{python3_pkgversion}-numpy-f2py
%{_bindir}/f2py%{python3_version}
%ghost %{_bindir}/f2py3
%{python3_sitearch}/%{modname}/f2py
%changelog