mirror of
https://github.com/void-linux/void-packages.git
synced 2025-04-16 06:07:00 +02:00
python3-inotify: make asyncore optional
Python 3.12 removed asyncore, and upstream looks abandoned
This commit is contained in:
parent
43f4e13490
commit
da7b2b3003
2 changed files with 78 additions and 1 deletions
77
srcpkgs/python3-inotify/patches/optional-asyncore.patch
Normal file
77
srcpkgs/python3-inotify/patches/optional-asyncore.patch
Normal file
|
@ -0,0 +1,77 @@
|
|||
# Python 3.12 removed asyncore, this removes the dependency while allowing for use of the compatibility package
|
||||
# Taken from https://github.com/seb-m/pyinotify/pull/205
|
||||
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,7 +1,7 @@
|
|||
# Template file for 'python3-inotify'
|
||||
pkgname=python3-inotify
|
||||
version=0.9.6
|
||||
revision=9
|
||||
revision=10
|
||||
build_style=python3-module
|
||||
hostmakedepends="python3-setuptools"
|
||||
depends="python3"
|
||||
|
|
Loading…
Add table
Reference in a new issue