From c8765590554ab3f893c14eec12546abf86cbaa3e Mon Sep 17 00:00:00 2001 From: Philip Taron Date: Wed, 20 May 2026 13:25:49 -0700 Subject: [PATCH] python3Packages.tpm2-pytss: fix build with cryptography 47 cryptography 47.0.0 made __deepcopy__ an abstract method on the RSAPrivateKey and EllipticCurvePrivateKey base classes, which tpm2-pytss subclasses. tpm2-pytss 2.3.0 only implements __copy__, so its tpm_rsa_private_key / tpm_ecc_private_key classes can no longer be instantiated, failing 33 tests in the check phase. Backport the upstream fix, which adds __deepcopy__ delegating to __copy__. https://github.com/tpm2-software/tpm2-pytss/pull/689 --- pkgs/development/python-modules/tpm2-pytss/default.nix | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/pkgs/development/python-modules/tpm2-pytss/default.nix b/pkgs/development/python-modules/tpm2-pytss/default.nix index dbefc00be8c3..9c1fa30570b7 100644 --- a/pkgs/development/python-modules/tpm2-pytss/default.nix +++ b/pkgs/development/python-modules/tpm2-pytss/default.nix @@ -45,6 +45,13 @@ buildPythonPackage rec { url = "https://github.com/tpm2-software/tpm2-pytss/commit/6ab4c74e6fb3da7cd38e97c1f8e92532312f8439.patch"; hash = "sha256-01Qe4qpD2IINc5Z120iVdPitiLBwdr8KNBjLFnGgE7E="; }) + # support cryptography >= 47.0.0, which made __deepcopy__ an abstract + # method on the private-key base classes + # https://github.com/tpm2-software/tpm2-pytss/pull/689 + (fetchpatch { + url = "https://github.com/tpm2-software/tpm2-pytss/commit/5d15cad4bde28902a4becb8e2a8e915aba8abbd0.patch"; + hash = "sha256-b2zVD7KJGVzJ765HO8LFAe9MyQmjOTpERmEqUrIg3oM="; + }) # Properly restore environment variables upon exit from # FAPIConfig context. Accepted into upstream, not yet released. (fetchpatch2 {