From 211ac9861a836e41f68177c2bbd0a99fac272ea6 Mon Sep 17 00:00:00 2001 From: EnumDev Date: Wed, 6 May 2026 21:24:03 +0300 Subject: [PATCH] Rebuild with python 3.14 --- check-version.sh | 9 +++ pkg.info | 11 ++- source-files/pyinotify-python-3.12-fix.patch | 82 ++++++++++++++++++++ source.sh | 17 +--- 4 files changed, 104 insertions(+), 15 deletions(-) create mode 100644 check-version.sh create mode 100644 source-files/pyinotify-python-3.12-fix.patch diff --git a/check-version.sh b/check-version.sh new file mode 100644 index 0000000..e0d2aef --- /dev/null +++ b/check-version.sh @@ -0,0 +1,9 @@ +#!/bin/bash + +# Github repository +REPO="seb-m/pyinotify" + +# Get tag name using Github Rest API +TAG_NAME=$(curl -s -L -H "X-GitHub-Api-Version: 2022-11-28" -H "Authorization: token ${GITHUB_API_TOKEN}" https://api.github.com/repos/"$REPO"/tags | jq -r '.[0].name') + +echo "$TAG_NAME" diff --git a/pkg.info b/pkg.info index 3fa4484..376f6d7 100644 --- a/pkg.info +++ b/pkg.info @@ -1,13 +1,20 @@ name: python-pyinotify description: Python module for monitoring filesystems events with inotify on Linux version: 0.9.6 -revision: 1 +revision: 2 url: https://github.com/seb-m/pyinotify license: MIT +maintainers: + - enumdev@enumerated.dev architecture: any output_architecture: any type: source depends: - - python3 + - python3=3.14.* make_depends: - python-setuptools +downloads: + - url: https://github.com/seb-m/pyinotify/archive/refs/tags/${BPM_PKG_VERSION}.tar.gz + extract_to: ${BPM_SOURCE} + extract_strip_components: 1 + checksum: 7943f198c5cef2bdc121d847937fbe565daaa7d4daaf1b8de8ef5689812f481c diff --git a/source-files/pyinotify-python-3.12-fix.patch b/source-files/pyinotify-python-3.12-fix.patch new file mode 100644 index 0000000..565138b --- /dev/null +++ b/source-files/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/source.sh b/source.sh index a191d43..158def4 100644 --- a/source.sh +++ b/source.sh @@ -2,26 +2,16 @@ # BPM Expects the source code to be extracted into the automatically created 'source' directory which can be accessed using $BPM_SOURCE # BPM Expects the output files to be present in the automatically created 'output' directory which can be accessed using $BPM_OUTPUT -DOWNLOAD="https://github.com/seb-m/pyinotify/archive/refs/tags/${BPM_PKG_VERSION}.tar.gz" -DOWNLOAD_PATCH="https://github.com/seb-m/pyinotify/commit/478d595a7d086423733e9f5da5edfe9f1df48682.patch" -FILENAME="${DOWNLOAD##*/}" -FILENAME_PATCH="${DOWNLOAD_PATCH##*/}" - # The prepare function is executed in the root of the temp directory -# This function is used for downloading files and putting them into the correct location +# This function is used for putting downloaded files to the correct location or applying patches prepare() { - wget "$DOWNLOAD" - # Patch to make asyncore optional for Python 3.x - wget "$DOWNLOAD_PATCH" - - tar -xvf "$FILENAME" --strip-components=1 -C "$BPM_SOURCE" + cd "$BPM_SOURCE" + patch -Np1 -i "$BPM_WORKDIR"/pyinotify-python-3.12-fix.patch } # The build function is executed in the source directory # This function is used to compile the source code build() { - patch -Np1 < ../"${FILENAME_PATCH##*/}" - python3 setup.py build } @@ -30,5 +20,6 @@ build() { package() { python3 setup.py install --root="$BPM_OUTPUT" --prefix=/usr + # Install package license install -Dm644 "$BPM_SOURCE"/COPYING "$BPM_OUTPUT"/usr/share/licenses/python-pyinotify/COPYING }