diff options
author | Jörg Thalheim <joerg@higgsboson.tk> | 2017-01-23 14:25:19 +0100 |
---|---|---|
committer | Jörg Thalheim <joerg@higgsboson.tk> | 2017-01-24 10:31:55 +0100 |
commit | 094ac2d9b1d3c6895a9c9e0e4401919c475f4f2c (patch) | |
tree | 41b86d65fb78546ce02ac74e69f1aaae31d7b6c2 /pkgs/development/python-modules/protobuf.nix | |
parent | 6db593164add0146469755025908f0361ae7441e (diff) | |
download | nixlib-094ac2d9b1d3c6895a9c9e0e4401919c475f4f2c.tar nixlib-094ac2d9b1d3c6895a9c9e0e4401919c475f4f2c.tar.gz nixlib-094ac2d9b1d3c6895a9c9e0e4401919c475f4f2c.tar.bz2 nixlib-094ac2d9b1d3c6895a9c9e0e4401919c475f4f2c.tar.lz nixlib-094ac2d9b1d3c6895a9c9e0e4401919c475f4f2c.tar.xz nixlib-094ac2d9b1d3c6895a9c9e0e4401919c475f4f2c.tar.zst nixlib-094ac2d9b1d3c6895a9c9e0e4401919c475f4f2c.zip |
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
Diffstat (limited to 'pkgs/development/python-modules/protobuf.nix')
-rw-r--r-- | pkgs/development/python-modules/protobuf.nix | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/pkgs/development/python-modules/protobuf.nix b/pkgs/development/python-modules/protobuf.nix new file mode 100644 index 000000000000..8b9d1ddb03c4 --- /dev/null +++ b/pkgs/development/python-modules/protobuf.nix @@ -0,0 +1,46 @@ +{ 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; +} |