From 00e0f5204622527f21aba9359b5e58b79c5c3820 Mon Sep 17 00:00:00 2001 From: Edgar Vincent Date: Mon, 14 Sep 2026 23:23:49 +0200 Subject: [PATCH] hplip: fix startup crash on Python 3.14 Python 3.14 removed urllib.request.URLopener, which makes every hp-* tool crash at import time with: AttributeError: module 'urllib.request' has no attribute 'URLopener' This applies the Debian/Ubuntu patch that removes references to it until upstream updates the code. Fixes #563273. --- pkgs/by-name/hp/hplip/package.nix | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/pkgs/by-name/hp/hplip/package.nix b/pkgs/by-name/hp/hplip/package.nix index a2bbe644a777..39b48252502c 100644 --- a/pkgs/by-name/hp/hplip/package.nix +++ b/pkgs/by-name/hp/hplip/package.nix @@ -2,6 +2,7 @@ lib, stdenv, fetchurl, + fetchpatch, replaceVars, pkg-config, autoreconfHook, @@ -157,6 +158,14 @@ python3Packages.buildPythonApplication { url = "https://web.archive.org/web/20230226174550/https://sources.debian.org/data/main/h/hplip/3.22.10+dfsg0-1/debian/patches/0028-Remove-ImageProcessor-binary-installs.patch"; hash = "sha256-tNYccuwrcx5WCe7ULk8r8J6MVcUytGspiW64zAvO0qI="; }) + # Python 3.14 removed urllib.request.URLopener. Remove references to it until + # upstream updates the code accordingly. + # See https://bugs.launchpad.net/hplip/+bug/2115046 and + # https://bugs.launchpad.net/ubuntu/+source/hplip/+bug/2146570 + (fetchpatch { + url = "https://launchpadlibrarian.net/800485629/hplip-no-urlopener.patch"; + hash = "sha256-LCd43WnwPo6SBjcxGI3bVryWedDeyKXc9tCF16edDK4="; + }) ]; postPatch = ''