15
0
forked from pool/python-Mako

Accepting request 919795 from home:schubi2

- Use libalternatives instead of update-alternatives.

OBS-URL: https://build.opensuse.org/request/show/919795
OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-Mako?expand=0&rev=78
This commit is contained in:
2021-09-17 20:48:49 +00:00
committed by Git OBS Bridge
parent af3e197bbb
commit 79b88cb710
2 changed files with 39 additions and 1 deletions

View File

@@ -16,6 +16,12 @@
#
%if 0%{?suse_version} > 1500
%bcond_without libalternatives
%else
%bcond_with libalternatives
%endif
%define oldpython python
%{?!python_module:%define python_module() python-%{**} python3-%{**}}
Name: python-Mako
@@ -35,8 +41,12 @@ BuildRequires: fdupes
BuildRequires: python-rpm-macros
Requires: python-MarkupSafe >= 0.9.2
Requires: python-setuptools
%if %{with libalternatives}
Requires: alts
%else
Requires(post): update-alternatives
Requires(postun): update-alternatives
%endif
BuildArch: noarch
%if 0%{?suse_version} >= 1000 || 0%{?fedora_version} >= 24
Recommends: python-Beaker >= 1.1
@@ -66,23 +76,46 @@ scoping semantics.
%install
%python_install
%python_clone -a %{buildroot}%{_bindir}/mako-render
%if ! %{with libalternatives}
%python_clone -a %{buildroot}%{_bindir}/mako-render
%else
%python_clone %{buildroot}%{_bindir}/mako-render
ln -sf %{_bindir}/alts %{buildroot}%{_bindir}/mako-render
mkdir -p %{buildroot}%{_datadir}/libalternatives/mako-render
%python_expand echo "binary=%{_bindir}/mako-render-%{$python_version}" > %{buildroot}%{_datadir}/libalternatives/mako-render/10%{$python_version_nodots}.conf
%endif
%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 mako-render
fi
%else
%post
%python_install_alternative mako-render
%postun
%python_uninstall_alternative mako-render
%endif
%files %{python_files}
%license LICENSE
%doc CHANGES README.rst
%doc examples
%if ! 0%{with libalternatives}
%python_alternative %{_bindir}/mako-render
%else
%dir %{_datadir}/libalternatives
%dir %{_datadir}/libalternatives/mako-render
%{_datadir}/libalternatives/mako-render/10%python_version_nodots.conf
%{_bindir}/mako-render
%{_bindir}/mako-render-%python_version
%endif
%{python_sitelib}/mako/
%{python_sitelib}/Mako-%{version}-py*.egg-info