From cc88efc7d54936d8810efdd07271bcc79a27d019 Mon Sep 17 00:00:00 2001 From: Gaetan Lepage Date: Mon, 23 Mar 2026 09:49:16 +0000 Subject: [PATCH] python3Packages.tensorflow-datasets: fix tests --- .../tensorflow-datasets/default.nix | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/pkgs/development/python-modules/tensorflow-datasets/default.nix b/pkgs/development/python-modules/tensorflow-datasets/default.nix index d946d3d11ec7..6de4478928a9 100644 --- a/pkgs/development/python-modules/tensorflow-datasets/default.nix +++ b/pkgs/development/python-modules/tensorflow-datasets/default.nix @@ -85,6 +85,25 @@ buildPythonPackage (finalAttrs: { }) ]; + postPatch = + # AttributeError: 'google._upb._message.FieldDescriptor' object has no attribute 'label' + '' + substituteInPlace tensorflow_datasets/core/dataset_info.py \ + --replace-fail \ + "elif field.label == field.LABEL_REPEATED:" \ + "elif hasattr(field_value, 'extend'):" + '' + # TypeError: only 0-dimensional arrays can be converted to Python scalars + + '' + substituteInPlace tensorflow_datasets/datasets/smallnorb/smallnorb_dataset_builder.py \ + --replace-fail \ + "magic = int(np.frombuffer(s, dtype=int32_dtype, count=1))" \ + "magic = int(np.squeeze(np.frombuffer(s, dtype=int32_dtype, count=1)))" \ + --replace-fail \ + "ndim = int(np.frombuffer(s, dtype=int32_dtype, count=1, offset=4))" \ + "ndim = int(np.squeeze(np.frombuffer(s, dtype=int32_dtype, count=1, offset=4)))" + ''; + build-system = [ setuptools ]; dependencies = [