From 9a6777d143cd454a535dd9c8b04f76387f38d1ca Mon Sep 17 00:00:00 2001 From: phanirithvij Date: Sun, 5 Jul 2026 20:09:14 +0530 Subject: [PATCH] python3Packages.python3-eventlib: fix build of blink-qt Signed-off-by: phanirithvij --- .../0001-fixes-for-python3.14.patch | 49 +++++++++++++++++++ .../python3-eventlib/default.nix | 5 ++ 2 files changed, 54 insertions(+) create mode 100644 pkgs/development/python-modules/python3-eventlib/0001-fixes-for-python3.14.patch diff --git a/pkgs/development/python-modules/python3-eventlib/0001-fixes-for-python3.14.patch b/pkgs/development/python-modules/python3-eventlib/0001-fixes-for-python3.14.patch new file mode 100644 index 000000000000..738b2f500328 --- /dev/null +++ b/pkgs/development/python-modules/python3-eventlib/0001-fixes-for-python3.14.patch @@ -0,0 +1,49 @@ +From c3076f3ae4567af11dc6815550487adaff69ce03 Mon Sep 17 00:00:00 2001 +From: phanirithvij +Date: Sun, 5 Jul 2026 18:30:15 +0530 +Subject: [PATCH] fixes for python3.14 + +Add fallback stubs for urllib attributes removed in Python 3.14. +--- + eventlib/green/urllib.py | 18 ++++++++++++++++-- + 1 file changed, 16 insertions(+), 2 deletions(-) + +diff --git a/eventlib/green/urllib.py b/eventlib/green/urllib.py +index 0c8e375..ba82160 100644 +--- a/eventlib/green/urllib.py ++++ b/eventlib/green/urllib.py +@@ -7,7 +7,12 @@ from eventlib.green import socket, time + from urllib.error import( __all__ ) + from urllib.response import( __all__ ) + from urllib.robotparser import( __all__ ) +-from urllib.request import( __all__, __version__, MAXFTPCACHE, ftpcache, ftpwrapper, _noheaders, noheaders, proxy_bypass, addinfourl, url2pathname, getproxies) ++try: ++ from urllib.request import( __all__, __version__, MAXFTPCACHE, ftpcache, ftpwrapper, _noheaders, noheaders, proxy_bypass, addinfourl, url2pathname, getproxies) ++except ImportError: ++ from urllib.request import( __all__, __version__, ftpwrapper, _noheaders, noheaders, proxy_bypass, addinfourl, url2pathname, getproxies) ++ MAXFTPCACHE = 10 ++ ftpcache = {} + from urllib.parse import( __all__, quote, unwrap, unquote, splithost, splituser, splittype, splitattr, splitpasswd, splitport, splitquery, splitvalue) + from urllib.parse import urljoin as basejoin + +@@ -41,7 +46,16 @@ def urlcleanup(): + _urlopener.cleanup() + + +-class URLopener(urllib.request.URLopener): ++try: ++ _URLopener = urllib.request.URLopener ++ _FancyURLopener = urllib.request.FancyURLopener ++except AttributeError: ++ class _URLopener(object): ++ def __init__(self, *args, **kwargs): pass ++ class _FancyURLopener(_URLopener): ++ pass ++ ++class URLopener(_URLopener): + + def open_http(self, url, data=None): + """Use HTTP protocol.""" +-- +2.54.0 + diff --git a/pkgs/development/python-modules/python3-eventlib/default.nix b/pkgs/development/python-modules/python3-eventlib/default.nix index a2e63e597ffa..34958a136738 100644 --- a/pkgs/development/python-modules/python3-eventlib/default.nix +++ b/pkgs/development/python-modules/python3-eventlib/default.nix @@ -20,6 +20,11 @@ buildPythonPackage (finalAttrs: { hash = "sha256-jN9nn+rI4TJLrEiEIoVxQ3XnXWSws1FenGUfG3doc94="; }; + patches = [ + # remove once new release with https://github.com/AGProjects/python3-eventlib/pull/4 + ./0001-fixes-for-python3.14.patch + ]; + build-system = [ setuptools ]; dependencies = [