Accepting request 926573 from home:schubi2

- Disable all update-alternatives install calls if libalternatives
  is used.
- Use libalternatives instead of update-alternatives.

OBS-URL: https://build.opensuse.org/request/show/926573
OBS-URL: https://build.opensuse.org/package/show/devel:languages:python:pytest/python-pytest?expand=0&rev=96
This commit is contained in:
Matej Cepl 2021-10-20 18:25:03 +00:00 committed by Git OBS Bridge
parent 4c389ce1a4
commit 79cd4c77bc
2 changed files with 31 additions and 2 deletions

View File

@ -1,3 +1,14 @@
-------------------------------------------------------------------
Wed Oct 20 15:51:17 UTC 2021 - schubi <schubi@localhost>
- Disable all update-alternatives install calls if libalternatives
is used.
-------------------------------------------------------------------
Fri Oct 1 06:25:34 UTC 2021 - Stefan Schubert <schubi@suse.de>
- Use libalternatives instead of update-alternatives.
-------------------------------------------------------------------
Tue Sep 14 09:22:10 UTC 2021 - Ondřej Súkup <mimi.vx@gmail.com>

View File

@ -1,5 +1,5 @@
#
# spec file
# spec file for package python
#
# Copyright (c) 2021 SUSE LLC
#
@ -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"
@ -37,7 +43,7 @@ BuildRequires: %{python_module setuptools >= 42.0}
BuildRequires: %{python_module setuptools_scm}
BuildRequires: %{python_module toml}
BuildRequires: fdupes
BuildRequires: python-rpm-macros
BuildRequires: python-rpm-macros >= 20210929
Requires: python-attrs >= 19.2.0
Requires: python-importlib-metadata >= 0.12
Requires: python-iniconfig
@ -47,8 +53,13 @@ Requires: python-py >= 1.8.2
Requires: python-setuptools
Requires: python-toml
Requires: python-wcwidth
%if %{with libalternatives}
Requires: alts
BuildRequires: alts
%else
Requires(post): update-alternatives
Requires(postun):update-alternatives
%endif
Obsoletes: python-pytest-doc
BuildArch: noarch
%if %{with test}
@ -99,7 +110,13 @@ sed -i '/^\[metadata\]/ a version = %{version}' setup.cfg
%endif
%if ! %{with test}
%pre
# If libalternatives is used: Removing old update-alternatives entries.
%python_libalternatives_reset_alternative pytest
%post
%if ! %{with libalternatives}
# py.test was the master until Oct 2020. boo#1178547
alternatives=$(update-alternatives --quiet --list py.test 2> /dev/null) && (
update-alternatives --remove-all py.test
@ -113,6 +130,7 @@ alternatives=$(update-alternatives --quiet --list py.test 2> /dev/null) && (
fi
done
) ||:
%endif
%python_install_alternative pytest py.test
%postun