summary refs log tree commit diff
path: root/pkgs/development/python-modules/protobuf
diff options
context:
space:
mode:
authorSamuel Dionne-Riel <samuel@dionne-riel.com>2018-12-09 22:15:48 -0500
committerRobert Schütz <robert.schuetz@stud.uni-heidelberg.de>2018-12-11 11:30:52 +0100
commitf9b16e60daa083496a640a062b4b552cf185ae92 (patch)
tree7e4ad46f7e24842eceaf42494e6b75841ff5d757 /pkgs/development/python-modules/protobuf
parentf07d5d125d697412018b615bff2887003c52e9b6 (diff)
downloadnixpkgs-f9b16e60daa083496a640a062b4b552cf185ae92.tar
nixpkgs-f9b16e60daa083496a640a062b4b552cf185ae92.tar.gz
nixpkgs-f9b16e60daa083496a640a062b4b552cf185ae92.tar.bz2
nixpkgs-f9b16e60daa083496a640a062b4b552cf185ae92.tar.lz
nixpkgs-f9b16e60daa083496a640a062b4b552cf185ae92.tar.xz
nixpkgs-f9b16e60daa083496a640a062b4b552cf185ae92.tar.zst
nixpkgs-f9b16e60daa083496a640a062b4b552cf185ae92.zip
pythonPackages.protobuf: apply patch for python 3.7 only when building with it
Change introduced in #50672.

The patch does not apply on older protobuf like protobuf3_1

```
$ nix-build -E 'with import ./. { }; python3Packages.protobuf.override { protobuf = protobuf3_1; }'
unpacking sources
unpacking source archive /nix/store/1zdyl0cxaa8ha2v1zp75zzdjd6j99d0m-source
source root is source
setting SOURCE_DATE_EPOCH to timestamp 315619200 of file source/util/python/BUILD
patching sources
applying patch /nix/store/yagx7hvylnnjq7lxbcia0y5lq1r736w3-0a59054c30e4f0ba10f10acfc1d7f3814c63e1a7.patch
patching file google/protobuf/pyext/descriptor.cc
Hunk #1 succeeded at 55 (offset -1 lines).
patching file google/protobuf/pyext/descriptor_containers.cc
patching file google/protobuf/pyext/descriptor_pool.cc
Hunk #1 succeeded at 47 (offset -1 lines).
patching file google/protobuf/pyext/extension_dict.cc
Hunk #1 FAILED at 53.
1 out of 1 hunk FAILED -- saving rejects to file google/protobuf/pyext/extension_dict.cc.rej
patching file google/protobuf/pyext/message.cc
Hunk #1 succeeded at 82 (offset 3 lines).
Hunk #2 succeeded at 1425 (offset -104 lines).
```

Since the patch isn't necessary on python versions older than 3.7, let's
only apply it for version 3.7. This means that most things using older
protobuf implementation will now be able to build when using an older
pythonPackage set (as is most probably the case anyway).

This still leaves protobuf 3.1 using packages hanging, but the errors
will be localized to those that would be breaking anyway with the
upgrade to 3.7 as default python.
Diffstat (limited to 'pkgs/development/python-modules/protobuf')
-rw-r--r--pkgs/development/python-modules/protobuf/default.nix6
1 files changed, 3 insertions, 3 deletions
diff --git a/pkgs/development/python-modules/protobuf/default.nix b/pkgs/development/python-modules/protobuf/default.nix
index a9d20983a55..7a67ce29240 100644
--- a/pkgs/development/python-modules/protobuf/default.nix
+++ b/pkgs/development/python-modules/protobuf/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchpatch, python, buildPythonPackage
+{ stdenv, fetchpatch, python, buildPythonPackage, isPy37
 , protobuf, google_apputils, pyext, libcxx
 , disabled, doCheck ? true }:
 
@@ -16,14 +16,14 @@ buildPythonPackage rec {
   propagatedBuildInputs = [ protobuf google_apputils ];
   buildInputs = [ google_apputils pyext ];
 
-  patches = [
+  patches = optional isPy37
     # Python 3.7 compatibility (remove when protobuf 3.7 is released)
     (fetchpatch {
       url = "https://github.com/protocolbuffers/protobuf/commit/0a59054c30e4f0ba10f10acfc1d7f3814c63e1a7.patch";
       sha256 = "09hw22y3423v8bbmc9xm07znwdxfbya6rp78d4zqw6fisdvjkqf1";
       stripLen = 1;
     })
-  ];
+  ;
 
   prePatch = ''
     while [ ! -d python ]; do