From 5d1673866294873536610ff3f3032ccf46d9c1c8 Mon Sep 17 00:00:00 2001 From: Lorenzo Manacorda Date: Sat, 4 Apr 2026 19:57:59 +0200 Subject: [PATCH] python3Packages.diceware: fix test failure with python 3.14 Backport upstream fix that sets `prog` explicitly in `ArgumentParser`, since Python 3.14 changed how the default prog name is derived and monkeypatching `sys.argv` no longer affects it. --- .../python-modules/diceware/default.nix | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/pkgs/development/python-modules/diceware/default.nix b/pkgs/development/python-modules/diceware/default.nix index 540440db246c..d478f820d5e7 100644 --- a/pkgs/development/python-modules/diceware/default.nix +++ b/pkgs/development/python-modules/diceware/default.nix @@ -4,6 +4,7 @@ fetchPypi, setuptools, pytestCheckHook, + fetchpatch2, }: buildPythonPackage rec { @@ -16,6 +17,20 @@ buildPythonPackage rec { hash = "sha256-VLaQgJ8MVqswhaGOFaDDgE1KDRJ/OK7wtc9fhZ0PZjk="; }; + patches = [ + (fetchpatch2 { + # Set prog in ArgumentParser explicitly to fix test failure with Python 3.14 + # https://github.com/ulif/diceware/issues/122 + url = "https://github.com/ulif/diceware/commit/77d98606748df7755f36ebbb3bd838b1cdd80c61.patch"; + includes = [ "diceware/__init__.py" ]; + hunks = [ + 2 + 3 + ]; + hash = "sha256-yXGotV/tq7/vCYhY+1OZgCW3r6/SXTTvsHIU/jywbHc="; + }) + ]; + build-system = [ setuptools ]; dependencies = [ setuptools ];