From 727314ed78a954f24f122bbd10ff10561bb722f2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20=C4=8Cun=C3=A1t?= Date: Sat, 8 Nov 2025 09:18:09 +0100 Subject: [PATCH] python3Packages.protobuf: check version compatibility Let's avoid situations from #459656 early, e.g. log https://hydra.nixos.org/build/312538974/nixlog/1/tail Note that python3Packages.protobuf is in protobuf.tests, so that we should notice when updating protobuf in particular. --- pkgs/development/python-modules/protobuf/6.nix | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/pkgs/development/python-modules/protobuf/6.nix b/pkgs/development/python-modules/protobuf/6.nix index d3aa019da237..f5ce6a82e716 100644 --- a/pkgs/development/python-modules/protobuf/6.nix +++ b/pkgs/development/python-modules/protobuf/6.nix @@ -23,8 +23,12 @@ buildPythonPackage rec { protobuf ]; - # the pypi source archive does not ship tests - doCheck = false; + doCheck = + # https://protobuf.dev/support/cross-version-runtime-guarantee/#backwards + # The non-python protobuf provides the protoc binary which must not be newer. + assert lib.versionAtLeast version ("6." + protobuf.version); + # the pypi source archive does not ship tests + false; pythonImportsCheck = [ "google.protobuf" @@ -45,7 +49,9 @@ buildPythonPackage rec { meta = { description = "Protocol Buffers are Google's data interchange format"; homepage = "https://developers.google.com/protocol-buffers/"; - changelog = "https://github.com/protocolbuffers/protobuf/releases/v${version}"; + changelog = "https://github.com/protocolbuffers/protobuf/releases/v${ + builtins.substring 2 (-1) version + }"; license = lib.licenses.bsd3; maintainers = with lib.maintainers; [ GaetanLepage ]; };