From 3938a02379053fce08af7570cebb3a56521ee6fd51fc49d023cf49ff4832fbb1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mark=C3=A9ta=20Machov=C3=A1?= Date: Thu, 21 Aug 2025 15:24:35 +0000 Subject: [PATCH] - Convert to libalternatives on SLE-16-based and newer systems only OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-pipx?expand=0&rev=31 --- python-pipx.changes | 5 +++++ python-pipx.spec | 19 +++++++++++++++++-- 2 files changed, 22 insertions(+), 2 deletions(-) diff --git a/python-pipx.changes b/python-pipx.changes index 2b55e54..a1114ae 100644 --- a/python-pipx.changes +++ b/python-pipx.changes @@ -1,3 +1,8 @@ +------------------------------------------------------------------- +Thu Aug 21 15:24:12 UTC 2025 - Markéta Machová + +- Convert to libalternatives on SLE-16-based and newer systems only + ------------------------------------------------------------------- Sat Jul 19 07:27:33 UTC 2025 - Markéta Machová diff --git a/python-pipx.spec b/python-pipx.spec index 4f0e7e0..c4c4497 100644 --- a/python-pipx.spec +++ b/python-pipx.spec @@ -16,7 +16,11 @@ # +%if 0%{?suse_version} > 1500 %bcond_without libalternatives +%else +%bcond_with libalternatives +%endif %{?sle15_python_module_pythons} Name: python-pipx Version: 1.7.1 @@ -28,10 +32,8 @@ Source: pipx-%{version}.tar.gz BuildRequires: %{python_module hatch-vcs >= 0.4} BuildRequires: %{python_module hatchling >= 1.18} BuildRequires: %{python_module pip} -BuildRequires: alts BuildRequires: fdupes BuildRequires: python-rpm-macros -Requires: alts Requires: python >= 3.8 Requires: python-argcomplete >= 1.9.4 Requires: python-packaging >= 20 @@ -39,6 +41,13 @@ Requires: python-platformdirs >= 2.1 Requires: python-userpath >= 1.6 Requires: (python-tomli if python-base < 3.11) BuildArch: noarch +%if %{with libalternatives} +BuildRequires: alts +Requires: alts +%else +Requires(post): update-alternatives +Requires(postun): update-alternatives +%endif # SECTION test requirements BuildRequires: %{python_module argcomplete >= 1.9.4} BuildRequires: %{python_module packaging >= 20} @@ -62,6 +71,12 @@ export SETUPTOOLS_SCM_PRETEND_VERSION=%{version} %python_clone -a %{buildroot}%{_bindir}/pipx %python_expand %fdupes %{buildroot}%{$python_sitelib} +%post +%python_install_alternative pipx + +%postun +%python_uninstall_alternative pipx + %pre %python_libalternatives_reset_alternative pipx