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