diff --git a/pyinotify-python-3.12-fix.patch b/pyinotify-python-3.12-fix.patch new file mode 100644 index 0000000..565138b --- /dev/null +++ b/pyinotify-python-3.12-fix.patch @@ -0,0 +1,82 @@ +commit 478d595a7d086423733e9f5da5edfe9f1df48682 +Author: Troy Curtis Jr +Date: Thu Aug 10 21:51:15 2023 -0400 + + Make asyncore support optional for Python 3. + + Fixes #204. + +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 @@ from collections import deque + from datetime import datetime, timedelta + import time + import re +-import asyncore + import glob + import locale + import subprocess +@@ -1494,33 +1493,40 @@ class ThreadedNotifier(threading.Thread, Notifier): + 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): diff --git a/python-inotify.spec b/python-inotify.spec index 8135293..91ea050 100644 --- a/python-inotify.spec +++ b/python-inotify.spec @@ -3,11 +3,14 @@ Summary: Monitor filesystem events with Python under Linux Name: python-inotify Version: 0.9.6 -Release: 31%{?dist} +Release: 32%{?dist} License: MIT URL: https://github.com/seb-m/pyinotify Source0: http://seb.dbzteam.org/pub/pyinotify/releases/pyinotify-%{version}.tar.gz Patch01: pyinotify-0.9.6-epoint.patch +# Upstream pull request https://github.com/seb-m/pyinotify/pull/205 +# Upstream issue https://github.com/seb-m/pyinotify/issues/204 +Patch02: pyinotify-python-3.12-fix.patch BuildRequires: gmp-devel BuildRequires: python%{python3_pkgversion}-devel BuildRequires: python%{python3_pkgversion}-setuptools @@ -26,7 +29,8 @@ Summary: %{summary} %prep %setup -q -n %{oname}-%{version} -%patch01 -p1 +%patch 1 -p1 +%patch 2 -p1 sed -i '1c#! %{__python3}' python3/pyinotify.py %build @@ -43,6 +47,9 @@ sed -i '1c#! %{__python3}' python3/pyinotify.py %{python3_sitelib}/__pycache__/%{oname}* %changelog +* Thu Aug 10 2023 Troy Curtis, Jr - 0.9.6-32 +- Fixes build for Python 3.12 (#2219556) + * Fri Jul 21 2023 Fedora Release Engineering - 0.9.6-31 - Rebuilt for https://fedoraproject.org/wiki/Fedora_39_Mass_Rebuild