lol

python3Packages.protobuf: use pkgs.protobuf_24

+12 -14
+11 -13
pkgs/development/python-modules/protobuf/default.nix
··· 11 11 , tzdata 12 12 }: 13 13 14 + assert lib.versionOlder protobuf.version "21" -> throw "Protobuf 21 or newer required"; 15 + 14 16 let 15 - versionMajor = lib.versions.major protobuf.version; 16 - versionMinor = lib.versions.minor protobuf.version; 17 - versionPatch = lib.versions.patch protobuf.version; 17 + protobufVersionMajor = lib.versions.major protobuf.version; 18 + protobufVersionMinor = lib.versions.minor protobuf.version; 18 19 in 19 20 buildPythonPackage { 20 21 inherit (protobuf) pname src; 21 22 22 - # protobuf 3.21 corresponds with its python library 4.21 23 - version = 24 - if lib.versionAtLeast protobuf.version "3.21" 25 - then "${toString (lib.toInt versionMajor + 1)}.${versionMinor}.${versionPatch}" 26 - else protobuf.version; 23 + # protobuf 21 corresponds with its python library 4.21 24 + version = "4.${protobufVersionMajor}.${protobufVersionMinor}"; 27 25 28 26 sourceRoot = "${protobuf.src.name}/python"; 29 27 30 - patches = lib.optionals (lib.versionAtLeast protobuf.version "3.22") [ 28 + patches = lib.optionals (lib.versionAtLeast protobuf.version "22") [ 31 29 # Replace the vendored abseil-cpp with nixpkgs' 32 30 (substituteAll { 33 31 src = ./use-nixpkgs-abseil-cpp.patch; 34 32 abseil_cpp_include_path = "${lib.getDev protobuf.abseil-cpp}/include"; 35 33 }) 36 34 ] 37 - ++ lib.optionals (pythonAtLeast "3.11" && lib.versionOlder protobuf.version "3.22") [ 35 + ++ lib.optionals (pythonAtLeast "3.11" && lib.versionOlder protobuf.version "22") [ 38 36 (fetchpatch { 39 37 name = "support-python311.patch"; 40 38 url = "https://github.com/protocolbuffers/protobuf/commit/2206b63c4649cf2e8a06b66c9191c8ef862ca519.diff"; ··· 69 67 70 68 propagatedNativeBuildInputs = [ 71 69 # For protoc of the same version. 72 - buildPackages."protobuf${lib.versions.major protobuf.version}_${lib.versions.minor protobuf.version}" 70 + buildPackages."protobuf_${protobufVersionMajor}" 73 71 ]; 74 72 75 73 setupPyGlobalFlags = [ "--cpp_implementation" ]; 76 74 77 75 nativeCheckInputs = [ 78 76 pytestCheckHook 79 - ] ++ lib.optionals (lib.versionAtLeast protobuf.version "3.22") [ 77 + ] ++ lib.optionals (lib.versionAtLeast protobuf.version "22") [ 80 78 numpy 81 79 ]; 82 80 ··· 90 88 "testStrictUtf8Check" 91 89 ]; 92 90 93 - disabledTestPaths = lib.optionals (lib.versionAtLeast protobuf.version "3.23") [ 91 + disabledTestPaths = lib.optionals (lib.versionAtLeast protobuf.version "23") [ 94 92 # The following commit (I think) added some internal test logic for Google 95 93 # that broke generator_test.py. There is a new proto file that setup.py is 96 94 # not generating into a .py file. However, adding this breaks a bunch of
+1 -1
pkgs/top-level/python-packages.nix
··· 9487 9487 # Protobuf 4.x 9488 9488 protobuf = callPackage ../development/python-modules/protobuf { 9489 9489 # If a protobuf upgrade causes many Python packages to fail, please pin it here to the previous version. 9490 - inherit (pkgs) protobuf; 9490 + protobuf = pkgs.protobuf_24; 9491 9491 }; 9492 9492 9493 9493 # Protobuf 3.x