14
0

Convert to libalternatives, bsc#1245883

This commit is contained in:
2025-10-23 11:46:19 +02:00
parent f4805eb185
commit 6cb1073aa2
4 changed files with 132 additions and 8 deletions

View File

@@ -1,7 +1,7 @@
#
# spec file for package python-pyinotify
#
# Copyright (c) 2023 SUSE LLC
# Copyright (c) 2025 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
@@ -16,7 +16,12 @@
#
%{?!python_module:%define python_module() python-%{**} python3-%{**}}
%if 0%{?suse_version} > 1500
%bcond_without libalternatives
%else
%bcond_with libalternatives
%endif
%{?sle15_python_module_pythons}
Name: python-pyinotify
Version: 0.9.6
@@ -27,10 +32,19 @@ Group: Development/Libraries/Python
URL: https://github.com/seb-m/pyinotify
Source: https://files.pythonhosted.org/packages/source/p/pyinotify/pyinotify-%{version}.tar.gz
Source1: pyinotify
# PATCH-FIX_UPSTREAM https://github.com/seb-m/pyinotify/pull/205
Patch0: make_asyncore_support_optional.patch
BuildRequires: %{python_module pip}
BuildRequires: %{python_module setuptools}
BuildRequires: %{python_module wheel}
BuildRequires: python-rpm-macros
%if %{with libalternatives}
Requires: alts
BuildRequires: alts
%else
Requires(post): update-alternatives
Requires(postun):update-alternatives
Requires(postun): update-alternatives
%endif
BuildArch: noarch
%python_subpackages
@@ -51,20 +65,24 @@ to watch, the kind of events to monitor and the actions to execute on these
notifications.
%prep
%setup -q -n pyinotify-%{version}
%autosetup -p1 -n pyinotify-%{version}
# remove unwanted shebang
sed -i '/^#!/ d' python2/pyinotify.py
sed -i "s|#!%{_bindir}/env python|#!%__python2|" python2/examples/*py
sed -i "s|#!%{_bindir}/env python|#!%__python3|" python3/examples/*py
%build
%python_build
%pyproject_wheel
%install
%python_install
%pyproject_install
install -D -m 0755 %{SOURCE1} %{buildroot}%{_bindir}/pyinotify
%python_clone -a %{buildroot}%{_bindir}/pyinotify
%pre
# If libalternatives is used: Removing old update-alternatives entries.
%python_libalternatives_reset_alternative pyinotify
%post
%python_install_alternative pyinotify
@@ -77,6 +95,8 @@ install -D -m 0755 %{SOURCE1} %{buildroot}%{_bindir}/pyinotify
%doc old/ChangeLog old/NEWS
%doc python3/examples
%python_alternative %{_bindir}/pyinotify
%{python_sitelib}/*
%{python_sitelib}/pyinotify.py
%pycache_only %{python_sitelib}/__pycache__/pyinotify.*.pyc
%{python_sitelib}/pyinotify-%{version}.dist-info
%changelog