Compare commits
6 Commits
Author | SHA256 | Date | |
---|---|---|---|
4b4c5bba5b | |||
14e62a5563 | |||
617bd2b0d0 | |||
80eeaee860 | |||
584ca42a2c | |||
031d088199 |
84
make_asyncore_support_optional.patch
Normal file
84
make_asyncore_support_optional.patch
Normal file
@@ -0,0 +1,84 @@
|
|||||||
|
From 478d595a7d086423733e9f5da5edfe9f1df48682 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Troy Curtis Jr <troy@troycurtisjr.com>
|
||||||
|
Date: Thu, 10 Aug 2023 21:51:15 -0400
|
||||||
|
Subject: [PATCH] Make asyncore support optional for Python 3.
|
||||||
|
|
||||||
|
Fixes #204.
|
||||||
|
---
|
||||||
|
python3/pyinotify.py | 50 +++++++++++++++++++++++++-------------------
|
||||||
|
1 file changed, 28 insertions(+), 22 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/python3/pyinotify.py b/python3/pyinotify.py
|
||||||
|
index bc24313..f4a5a90 100755
|
||||||
|
--- a/python3/pyinotify.py
|
||||||
|
+++ b/python3/pyinotify.py
|
||||||
|
@@ -68,7 +68,6 @@ def __init__(self, version):
|
||||||
|
from datetime import datetime, timedelta
|
||||||
|
import time
|
||||||
|
import re
|
||||||
|
-import asyncore
|
||||||
|
import glob
|
||||||
|
import locale
|
||||||
|
import subprocess
|
||||||
|
@@ -1494,33 +1493,40 @@ def run(self):
|
||||||
|
self.loop()
|
||||||
|
|
||||||
|
|
||||||
|
-class AsyncNotifier(asyncore.file_dispatcher, Notifier):
|
||||||
|
- """
|
||||||
|
- This notifier inherits from asyncore.file_dispatcher in order to be able to
|
||||||
|
- use pyinotify along with the asyncore framework.
|
||||||
|
+try:
|
||||||
|
+ import asyncore
|
||||||
|
|
||||||
|
- """
|
||||||
|
- def __init__(self, watch_manager, default_proc_fun=None, read_freq=0,
|
||||||
|
- threshold=0, timeout=None, channel_map=None):
|
||||||
|
+ class AsyncNotifier(asyncore.file_dispatcher, Notifier):
|
||||||
|
"""
|
||||||
|
- Initializes the async notifier. The only additional parameter is
|
||||||
|
- 'channel_map' which is the optional asyncore private map. See
|
||||||
|
- Notifier class for the meaning of the others parameters.
|
||||||
|
+ This notifier inherits from asyncore.file_dispatcher in order to be able to
|
||||||
|
+ use pyinotify along with the asyncore framework.
|
||||||
|
|
||||||
|
"""
|
||||||
|
- Notifier.__init__(self, watch_manager, default_proc_fun, read_freq,
|
||||||
|
- threshold, timeout)
|
||||||
|
- asyncore.file_dispatcher.__init__(self, self._fd, channel_map)
|
||||||
|
+ def __init__(self, watch_manager, default_proc_fun=None, read_freq=0,
|
||||||
|
+ threshold=0, timeout=None, channel_map=None):
|
||||||
|
+ """
|
||||||
|
+ Initializes the async notifier. The only additional parameter is
|
||||||
|
+ 'channel_map' which is the optional asyncore private map. See
|
||||||
|
+ Notifier class for the meaning of the others parameters.
|
||||||
|
|
||||||
|
- def handle_read(self):
|
||||||
|
- """
|
||||||
|
- When asyncore tells us we can read from the fd, we proceed processing
|
||||||
|
- events. This method can be overridden for handling a notification
|
||||||
|
- differently.
|
||||||
|
+ """
|
||||||
|
+ Notifier.__init__(self, watch_manager, default_proc_fun, read_freq,
|
||||||
|
+ threshold, timeout)
|
||||||
|
+ asyncore.file_dispatcher.__init__(self, self._fd, channel_map)
|
||||||
|
|
||||||
|
- """
|
||||||
|
- self.read_events()
|
||||||
|
- self.process_events()
|
||||||
|
+ def handle_read(self):
|
||||||
|
+ """
|
||||||
|
+ When asyncore tells us we can read from the fd, we proceed processing
|
||||||
|
+ events. This method can be overridden for handling a notification
|
||||||
|
+ differently.
|
||||||
|
+
|
||||||
|
+ """
|
||||||
|
+ self.read_events()
|
||||||
|
+ self.process_events()
|
||||||
|
+except ImportError:
|
||||||
|
+ # asyncore was removed in Python 3.12, but try the import instead of a
|
||||||
|
+ # version check in case the compatibility package is installed.
|
||||||
|
+ pass
|
||||||
|
|
||||||
|
|
||||||
|
class TornadoAsyncNotifier(Notifier):
|
@@ -1,2 +1,2 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
python -m pyinotify "$@"
|
python3 -m pyinotify "$@"
|
||||||
|
@@ -1,3 +1,23 @@
|
|||||||
|
-------------------------------------------------------------------
|
||||||
|
Wed Jun 11 05:49:29 UTC 2025 - Steve Kowalik <steven.kowalik@suse.com>
|
||||||
|
|
||||||
|
- Switch to pyproject macros.
|
||||||
|
|
||||||
|
-------------------------------------------------------------------
|
||||||
|
Wed Mar 26 11:57:29 UTC 2025 - Nico Krapp <nico.krapp@suse.com>
|
||||||
|
|
||||||
|
- Use libalternatives instead of update-alternatives, bsc#1240097
|
||||||
|
- No more greedy globs in %files.
|
||||||
|
- Use python3 in pyinotify script
|
||||||
|
|
||||||
|
-------------------------------------------------------------------
|
||||||
|
Fri Mar 21 10:42:17 UTC 2025 - Pablo Suárez Hernández <pablo.suarezhernandez@suse.com>
|
||||||
|
|
||||||
|
- Make asyncore support optional to fix issue in Python 3.12 and 3.13
|
||||||
|
|
||||||
|
- Added:
|
||||||
|
* make_asyncore_support_optional.patch
|
||||||
|
|
||||||
-------------------------------------------------------------------
|
-------------------------------------------------------------------
|
||||||
Fri Apr 21 12:30:53 UTC 2023 - Dirk Müller <dmueller@suse.com>
|
Fri Apr 21 12:30:53 UTC 2023 - Dirk Müller <dmueller@suse.com>
|
||||||
|
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
#
|
#
|
||||||
# spec file for package python-pyinotify
|
# 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
|
# All modifications and additions to the file contributed by third parties
|
||||||
# remain the property of their copyright owners, unless otherwise agreed
|
# 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}
|
%{?sle15_python_module_pythons}
|
||||||
Name: python-pyinotify
|
Name: python-pyinotify
|
||||||
Version: 0.9.6
|
Version: 0.9.6
|
||||||
@@ -27,10 +32,19 @@ Group: Development/Libraries/Python
|
|||||||
URL: https://github.com/seb-m/pyinotify
|
URL: https://github.com/seb-m/pyinotify
|
||||||
Source: https://files.pythonhosted.org/packages/source/p/pyinotify/pyinotify-%{version}.tar.gz
|
Source: https://files.pythonhosted.org/packages/source/p/pyinotify/pyinotify-%{version}.tar.gz
|
||||||
Source1: pyinotify
|
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 setuptools}
|
||||||
|
BuildRequires: %{python_module wheel}
|
||||||
BuildRequires: python-rpm-macros
|
BuildRequires: python-rpm-macros
|
||||||
|
%if %{with libalternatives}
|
||||||
|
Requires: alts
|
||||||
|
BuildRequires: alts
|
||||||
|
%else
|
||||||
Requires(post): update-alternatives
|
Requires(post): update-alternatives
|
||||||
Requires(postun):update-alternatives
|
Requires(postun): update-alternatives
|
||||||
|
%endif
|
||||||
BuildArch: noarch
|
BuildArch: noarch
|
||||||
%python_subpackages
|
%python_subpackages
|
||||||
|
|
||||||
@@ -51,20 +65,24 @@ to watch, the kind of events to monitor and the actions to execute on these
|
|||||||
notifications.
|
notifications.
|
||||||
|
|
||||||
%prep
|
%prep
|
||||||
%setup -q -n pyinotify-%{version}
|
%autosetup -p1 -n pyinotify-%{version}
|
||||||
# remove unwanted shebang
|
# remove unwanted shebang
|
||||||
sed -i '/^#!/ d' python2/pyinotify.py
|
sed -i '/^#!/ d' python2/pyinotify.py
|
||||||
sed -i "s|#!%{_bindir}/env python|#!%__python2|" python2/examples/*py
|
sed -i "s|#!%{_bindir}/env python|#!%__python2|" python2/examples/*py
|
||||||
sed -i "s|#!%{_bindir}/env python|#!%__python3|" python3/examples/*py
|
sed -i "s|#!%{_bindir}/env python|#!%__python3|" python3/examples/*py
|
||||||
|
|
||||||
%build
|
%build
|
||||||
%python_build
|
%pyproject_wheel
|
||||||
|
|
||||||
%install
|
%install
|
||||||
%python_install
|
%pyproject_install
|
||||||
install -D -m 0755 %{SOURCE1} %{buildroot}%{_bindir}/pyinotify
|
install -D -m 0755 %{SOURCE1} %{buildroot}%{_bindir}/pyinotify
|
||||||
%python_clone -a %{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
|
%post
|
||||||
%python_install_alternative pyinotify
|
%python_install_alternative pyinotify
|
||||||
|
|
||||||
@@ -77,6 +95,8 @@ install -D -m 0755 %{SOURCE1} %{buildroot}%{_bindir}/pyinotify
|
|||||||
%doc old/ChangeLog old/NEWS
|
%doc old/ChangeLog old/NEWS
|
||||||
%doc python3/examples
|
%doc python3/examples
|
||||||
%python_alternative %{_bindir}/pyinotify
|
%python_alternative %{_bindir}/pyinotify
|
||||||
%{python_sitelib}/*
|
%{python_sitelib}/pyinotify.py
|
||||||
|
%pycache_only %{python_sitelib}/__pycache__/pyinotify.*.pyc
|
||||||
|
%{python_sitelib}/pyinotify-%{version}.dist-info
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
Reference in New Issue
Block a user