diff --git a/python-Mako.changes b/python-Mako.changes index 32cabc9..94dba35 100644 --- a/python-Mako.changes +++ b/python-Mako.changes @@ -1,3 +1,8 @@ +------------------------------------------------------------------- +Mon Aug 23 07:06:10 UTC 2021 - Stefan Schubert + +- Use libalternatives instead of update-alternatives. + ------------------------------------------------------------------- Sun Jan 24 19:48:33 UTC 2021 - Dirk Müller diff --git a/python-Mako.spec b/python-Mako.spec index bb665bb..6e27a45 100644 --- a/python-Mako.spec +++ b/python-Mako.spec @@ -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