From daa79c109876405ad94aaf2283f8f84a7ee5ef4e037e6bd6ed05a46b3b2cf457 Mon Sep 17 00:00:00 2001 From: Daniel Garcia Moreno Date: Thu, 23 Oct 2025 11:41:25 +0200 Subject: [PATCH] Convert to libalternatives, bsc#1245883 --- python-bottle.changes | 15 +++++++++++++++ python-bottle.spec | 24 ++++++++++++++++++++---- 2 files changed, 35 insertions(+), 4 deletions(-) diff --git a/python-bottle.changes b/python-bottle.changes index e5c9463..fef6d4c 100644 --- a/python-bottle.changes +++ b/python-bottle.changes @@ -1,3 +1,18 @@ +------------------------------------------------------------------- +Mon Aug 11 14:01:21 UTC 2025 - Markéta Machová + +- Make the libalternatives transition conditional + +------------------------------------------------------------------- +Tue Jul 15 06:52:35 UTC 2025 - Daniel Garcia + +- Do not put bottle.py in /usr/bin, bsc#1245790 + +------------------------------------------------------------------- +Tue Jun 17 08:43:33 UTC 2025 - Markéta Machová + +- Convert to libalternatives + ------------------------------------------------------------------- Mon Apr 21 13:26:32 UTC 2025 - Benoît Monin diff --git a/python-bottle.spec b/python-bottle.spec index 3756dd6..d37f3ff 100644 --- a/python-bottle.spec +++ b/python-bottle.spec @@ -16,6 +16,11 @@ # +%if 0%{?suse_version} > 1500 +%bcond_without libalternatives +%else +%bcond_with libalternatives +%endif %{?sle15_python_module_pythons} Name: python-bottle Version: 0.13.3 @@ -30,8 +35,13 @@ BuildRequires: %{python_module setuptools} BuildRequires: %{python_module wheel} BuildRequires: fdupes BuildRequires: python-rpm-macros +%if %{with libalternatives} +BuildRequires: alts +Requires: alts +%else Requires(post): update-alternatives Requires(postun): update-alternatives +%endif BuildArch: noarch %python_subpackages @@ -60,29 +70,35 @@ This subpackage contains the PDF documentation for %{name}. %prep %autosetup -p1 -n bottle-%{version} cp %{SOURCE1} . +chmod 644 bottle.py +sed -i '1{ /^#!/d }' bottle.py %build %pyproject_wheel %install %pyproject_install +rm -rf %{buildroot}%{_bindir}/bottle.py %python_expand %fdupes %{buildroot}%{$python_sitelib} -%python_clone -a %{buildroot}%{_bindir}/bottle.py %python_clone -a %{buildroot}%{_bindir}/bottle %check %pyunittest -v +%pre +%python_libalternatives_reset_alternative bottle.py +%python_libalternatives_reset_alternative bottle + %post -%python_install_alternative bottle.py bottle +%python_install_alternative bottle %postun -%python_uninstall_alternative bottle.py bottle +%python_uninstall_alternative bottle.py +%python_uninstall_alternative bottle %files %{python_files} %license LICENSE %doc README.rst -%python_alternative %{_bindir}/bottle.py %python_alternative %{_bindir}/bottle %{python_sitelib}/bottle.py* %pycache_only %{python_sitelib}/__pycache__