diff --git a/python-chardet.changes b/python-chardet.changes index 8006982..432b5a0 100644 --- a/python-chardet.changes +++ b/python-chardet.changes @@ -1,3 +1,8 @@ +------------------------------------------------------------------- +Thu Sep 30 08:18:47 UTC 2021 - Stefan Schubert + +- Use libalternatives instead of update-alternatives. + ------------------------------------------------------------------- Sun Dec 20 05:52:28 UTC 2020 - John Vandenberg diff --git a/python-chardet.spec b/python-chardet.spec index b5c3bd8..baaa249 100644 --- a/python-chardet.spec +++ b/python-chardet.spec @@ -1,7 +1,7 @@ # # spec file for package python-chardet # -# Copyright (c) 2020 SUSE LLC +# Copyright (c) 2021 SUSE LLC # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -16,6 +16,12 @@ # +%if 0%{?suse_version} > 1500 +%bcond_without libalternatives +%else +%bcond_with libalternatives +%endif + %{?!python_module:%define python_module() python-%{**} python3-%{**}} %global flavor @BUILD_FLAVOR@%{nil} %if "%{flavor}" == "test" @@ -34,9 +40,14 @@ URL: https://github.com/chardet/chardet Source0: https://files.pythonhosted.org/packages/source/c/chardet/chardet-%{version}.tar.gz BuildRequires: %{python_module setuptools} BuildRequires: fdupes -BuildRequires: python-rpm-macros +BuildRequires: python-rpm-macros >= 20210929 +%if %{with libalternatives} +BuildRequires: alts +Requires: alts +%else Requires(post): update-alternatives Requires(postun): update-alternatives +%endif BuildArch: noarch %if %{with test} BuildRequires: %{python_module hypothesis} @@ -95,6 +106,10 @@ mv %{buildroot}%{_bindir}/chardetect %{buildroot}%{_bindir}/chardetect-%{$python %endif %if !%{with test} +%pre +# If libalternatives is used: Removing old update-alternatives entries. +%python_libalternatives_reset_alternative chardetect + %post %python_install_alternative chardetect