Github messages for voidlinux
 help / color / mirror / Atom feed
From: cinerea0 <cinerea0@users.noreply.github.com>
To: ml@inbox.vuxu.org
Subject: [PR PATCH] python3-inotify: make asyncore optional
Date: Wed, 11 Oct 2023 03:40:39 +0200	[thread overview]
Message-ID: <gh-mailinglist-notifications-41a7ca26-5023-4802-975b-f1789d68868e-void-packages-46578@inbox.vuxu.org> (raw)

[-- Attachment #1: Type: text/plain, Size: 398 bytes --]

There is a new pull request by cinerea0 against master on the void-packages repository

https://github.com/cinerea0/void-packages pyinotify
https://github.com/void-linux/void-packages/pull/46578

python3-inotify: make asyncore optional
#### Testing the changes
- I tested the changes in this PR: **YES**


A patch file from https://github.com/void-linux/void-packages/pull/46578.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-pyinotify-46578.patch --]
[-- Type: text/x-diff, Size: 4299 bytes --]

From 3886db0c4787be6974618974806b429445efc603 Mon Sep 17 00:00:00 2001
From: cinerea0 <cinerea0@disroot.org>
Date: Tue, 10 Oct 2023 21:39:34 -0400
Subject: [PATCH] python3-inotify: make asyncore optional

Python 3.12 removed asyncore, and upstream looks abandoned
---
 .../patches/optional-asyncore.patch           | 77 +++++++++++++++++++
 srcpkgs/python3-inotify/template              |  2 +-
 2 files changed, 78 insertions(+), 1 deletion(-)
 create mode 100644 srcpkgs/python3-inotify/patches/optional-asyncore.patch

diff --git a/srcpkgs/python3-inotify/patches/optional-asyncore.patch b/srcpkgs/python3-inotify/patches/optional-asyncore.patch
new file mode 100644
index 0000000000000..cfd5e646e6d1f
--- /dev/null
+++ b/srcpkgs/python3-inotify/patches/optional-asyncore.patch
@@ -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):
+
diff --git a/srcpkgs/python3-inotify/template b/srcpkgs/python3-inotify/template
index 4daf76e939316..b53c64fb25bfc 100644
--- a/srcpkgs/python3-inotify/template
+++ b/srcpkgs/python3-inotify/template
@@ -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"

             reply	other threads:[~2023-10-11  1:40 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-10-11  1:40 cinerea0 [this message]
2023-10-11  3:04 ` [PR PATCH] [Merged]: " ahesford

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=gh-mailinglist-notifications-41a7ca26-5023-4802-975b-f1789d68868e-void-packages-46578@inbox.vuxu.org \
    --to=cinerea0@users.noreply.github.com \
    --cc=ml@inbox.vuxu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).