From b954cf22d2e51ec198399bf4853286e01681a1641901f5da9a57a7b538bd2407 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mark=C3=A9ta=20Machov=C3=A1?= Date: Thu, 21 Aug 2025 08:23:45 +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-hatch?expand=0&rev=50 --- python-hatch.changes | 5 +++++ python-hatch.spec | 19 +++++++++++++++++-- 2 files changed, 22 insertions(+), 2 deletions(-) diff --git a/python-hatch.changes b/python-hatch.changes index 4301c80..33704e8 100644 --- a/python-hatch.changes +++ b/python-hatch.changes @@ -1,3 +1,8 @@ +------------------------------------------------------------------- +Thu Aug 21 08:22:26 UTC 2025 - Markéta Machová + +- Convert to libalternatives on SLE-16-based and newer systems only + ------------------------------------------------------------------- Thu Jul 10 12:33:57 UTC 2025 - Markéta Machová diff --git a/python-hatch.spec b/python-hatch.spec index 89d91ab..4f2cf8b 100644 --- a/python-hatch.spec +++ b/python-hatch.spec @@ -24,7 +24,11 @@ %define psuffix %{nil} %bcond_with test %endif +%if 0%{?suse_version} > 1500 %bcond_without libalternatives +%else +%bcond_with libalternatives +%endif %{?sle15_python_module_pythons} Name: python-hatch%{psuffix} Version: 1.14.1 @@ -42,10 +46,8 @@ BuildRequires: %{python_module base >= 3.8} BuildRequires: %{python_module hatch-vcs >= 0.3} BuildRequires: %{python_module hatchling >= 1.26.3} BuildRequires: %{python_module pip} -BuildRequires: alts BuildRequires: fdupes BuildRequires: python-rpm-macros -Requires: alts Requires: git-core Requires: python-click >= 8.0.6 Requires: python-hatchling >= 1.21.0 @@ -63,6 +65,13 @@ Requires: python-zstandard < 1 Requires: uv Requires: (python-pexpect >= 4.8 with python-pexpect < 5) Requires: (python-userpath >= 1.7 with python-userpath < 2) +%if %{with libalternatives} +BuildRequires: alts +Requires: alts +%else +Requires(post): update-alternatives +Requires(postun): update-alternatives +%endif %if %{with test} BuildRequires: %{python_module editables} BuildRequires: %{python_module filelock >= 3.7.1} @@ -136,6 +145,12 @@ donttest+=" or test_pyenv or test_no_open or test_open" %pytest -v -k "not ($donttest)" --ignore tests/cli/build/test_build.py %endif +%post +%python_install_alternative hatch + +%postun +%python_uninstall_alternative hatch + %pre %python_libalternatives_reset_alternative hatch