From b2e5b6048877b2cd4f809ccb17b8aa2a30d51e92 Mon Sep 17 00:00:00 2001 From: Willy Date: Wed, 22 Jul 2026 23:31:43 +0200 Subject: [PATCH] python3Packages.protobuf4: fix for setuptools >= 81 `pkg_resources` was finally removed, use `packaging` for parsing version strings instead this is the recommended approach from setuptools' docs: https://setuptools.pypa.io/en/latest/deprecated/pkg_resources.html --- pkgs/development/python-modules/protobuf/4.nix | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/pkgs/development/python-modules/protobuf/4.nix b/pkgs/development/python-modules/protobuf/4.nix index 9e88591bb108..4ba55804e1db 100644 --- a/pkgs/development/python-modules/protobuf/4.nix +++ b/pkgs/development/python-modules/protobuf/4.nix @@ -6,6 +6,7 @@ lib, stdenv, numpy, + packaging, protobuf, pytestCheckHook, pythonAtLeast, @@ -68,9 +69,18 @@ buildPythonPackage { + '' substituteInPlace google/protobuf/internal/json_format_test.py \ --replace-warn assertRaisesRegexp assertRaisesRegex + '' + # setuptools 81 dropped pkg_resources, parse versions via packaging module + + '' + substituteInPlace setup.py \ + --replace-fail "import pkg_resources" "import packaging.version" \ + --replace-fail "pkg_resources.parse_version" "packaging.version.parse" ''; - nativeBuildInputs = lib.optional isPyPy tzdata; + nativeBuildInputs = [ + packaging + ] + ++ lib.optional isPyPy tzdata; buildInputs = [ protobuf ];