nixpkgs mirror (for testing) github.com/NixOS/nixpkgs
nix

python3Packages.protobuf: fix derivation version

oxalica 16b4c7f0 46cbaad4

+19 -5
+19 -5
pkgs/development/python-modules/protobuf/default.nix
··· 6 6 , isPyPy 7 7 }: 8 8 9 + let 10 + versionMajor = lib.versions.major protobuf.version; 11 + versionMinor = lib.versions.minor protobuf.version; 12 + versionPatch = lib.versions.patch protobuf.version; 13 + in 9 14 buildPythonPackage { 10 - inherit (protobuf) pname src version; 15 + inherit (protobuf) pname src; 16 + 17 + # protobuf 3.21 coresponds with its python library 4.21 18 + version = 19 + if lib.versionAtLeast protobuf.version "3.21" 20 + then "${toString (lib.toInt versionMajor + 1)}.${versionMinor}.${versionPatch}" 21 + else protobuf.version; 22 + 11 23 disabled = isPyPy; 12 24 25 + sourceRoot = "source/python"; 26 + 13 27 prePatch = '' 14 - while [ ! -d python ]; do 15 - cd * 16 - done 17 - cd python 28 + if [[ "$(<../version.json)" != *'"python": "'"$version"'"'* ]]; then 29 + echo "Python library version mismatch. Derivation version: $version, actual: $(<../version.json)" 30 + exit 1 31 + fi 18 32 ''; 19 33 20 34 nativeBuildInputs = [ pyext ];