Merge pull request #147016 from knedlsepp/python-protobuf-cpp-backend
This commit is contained in:
commit
59cc7063c4
|
@ -18,8 +18,6 @@ buildPythonPackage {
|
||||||
inherit disabled;
|
inherit disabled;
|
||||||
doCheck = doCheck && !isPy27; # setuptools>=41.4 no longer collects correctly on python2
|
doCheck = doCheck && !isPy27; # setuptools>=41.4 no longer collects correctly on python2
|
||||||
|
|
||||||
outputs = [ "out" "dev" ];
|
|
||||||
|
|
||||||
propagatedBuildInputs = [ six ] ++ lib.optionals isPy27 [ google-apputils ];
|
propagatedBuildInputs = [ six ] ++ lib.optionals isPy27 [ google-apputils ];
|
||||||
propagatedNativeBuildInputs = [ buildPackages.protobuf ]; # For protoc.
|
propagatedNativeBuildInputs = [ buildPackages.protobuf ]; # For protoc.
|
||||||
nativeBuildInputs = [ pyext ] ++ lib.optionals isPy27 [ google-apputils ];
|
nativeBuildInputs = [ pyext ] ++ lib.optionals isPy27 [ google-apputils ];
|
||||||
|
@ -41,32 +39,20 @@ buildPythonPackage {
|
||||||
cd python
|
cd python
|
||||||
'';
|
'';
|
||||||
|
|
||||||
preConfigure = lib.optionalString (lib.versionAtLeast protobuf.version "2.6.0") ''
|
setupPyGlobalFlags = lib.optional (lib.versionAtLeast protobuf.version "2.6.0")
|
||||||
export PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION=cpp
|
"--cpp_implementation";
|
||||||
export PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION_VERSION=2
|
|
||||||
'';
|
|
||||||
|
|
||||||
preBuild = ''
|
pythonImportsCheck = [
|
||||||
# Workaround for https://github.com/google/protobuf/issues/2895
|
"google.protobuf"
|
||||||
${python.pythonForBuild.interpreter} setup.py build
|
] ++ lib.optionals (lib.versionAtLeast protobuf.version "2.6.0") [
|
||||||
'' + lib.optionalString (lib.versionAtLeast protobuf.version "2.6.0") ''
|
"google.protobuf.internal._api_implementation" # Verify that --cpp_implementation worked
|
||||||
${python.pythonForBuild.interpreter} setup.py build_ext --cpp_implementation
|
];
|
||||||
'';
|
|
||||||
|
|
||||||
installFlags = lib.optional (lib.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 = lib.optionalString (lib.versionAtLeast protobuf.version "2.6.0") ''
|
|
||||||
cp -v $(find build -name "_message*") $out/${python.sitePackages}/google/protobuf/pyext
|
|
||||||
'';
|
|
||||||
|
|
||||||
meta = with lib; {
|
meta = with lib; {
|
||||||
description = "Protocol Buffers are Google's data interchange format";
|
description = "Protocol Buffers are Google's data interchange format";
|
||||||
homepage = "https://developers.google.com/protocol-buffers/";
|
homepage = "https://developers.google.com/protocol-buffers/";
|
||||||
license = licenses.bsd3;
|
license = licenses.bsd3;
|
||||||
|
maintainers = with maintainers; [ knedlsepp ];
|
||||||
};
|
};
|
||||||
|
|
||||||
passthru.protobuf = protobuf;
|
passthru.protobuf = protobuf;
|
||||||
|
|
Loading…
Reference in a new issue