3
0
Fork 0
forked from mirrors/nixpkgs
nixpkgs/pkgs/development/python-modules/protobuf.nix
Jörg Thalheim 094ac2d9b1
python-protobuf: enable python3 and enable py3 tests
- moved expression out of python-packages
- no significant changes how package is built except the supported
  python versions
2017-01-24 10:31:55 +01:00

47 lines
1.4 KiB
Nix

{ stdenv, python, buildPythonPackage
, protobuf, google_apputils
, disabled, doCheck ? true }:
with stdenv.lib;
buildPythonPackage rec {
inherit (protobuf) name src;
inherit disabled doCheck;
propagatedBuildInputs = [ protobuf google_apputils ];
buildInputs = [ google_apputils ];
prePatch = ''
while [ ! -d python ]; do
cd *
done
cd python
'';
preConfigure = optionalString (versionAtLeast protobuf.version "2.6.0") ''
export PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION=cpp
export PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION_VERSION=2
'';
preBuild = optionalString (versionAtLeast protobuf.version "2.6.0") ''
${python}/bin/${python.executable} setup.py build_ext --cpp_implementation
'';
installFlags = optional (versionAtLeast protobuf.version "2.6.0")
"--install-option='--cpp_implementation'";
# the _message.so isn't installed, so we'll do that manually.
# if someone can figure out a less hacky way to get the _message.so to
# install, please do replace this.
postInstall = optionalString (versionAtLeast protobuf.version "2.6.0") ''
cp -v $(find build -name "_message*") $out/${python.sitePackages}/google/protobuf/pyext
'';
meta = {
description = "Protocol Buffers are Google's data interchange format";
homepage = https://developers.google.com/protocol-buffers/;
};
passthru.protobuf = protobuf;
}