diff --git a/pkgs/development/python-modules/protobuf/default.nix b/pkgs/development/python-modules/protobuf/default.nix index db3b73d7462..30e9fbf9ea7 100644 --- a/pkgs/development/python-modules/protobuf/default.nix +++ b/pkgs/development/python-modules/protobuf/default.nix @@ -18,8 +18,6 @@ buildPythonPackage { inherit disabled; doCheck = doCheck && !isPy27; # setuptools>=41.4 no longer collects correctly on python2 - outputs = [ "out" "dev" ]; - propagatedBuildInputs = [ six ] ++ lib.optionals isPy27 [ google-apputils ]; propagatedNativeBuildInputs = [ buildPackages.protobuf ]; # For protoc. nativeBuildInputs = [ pyext ] ++ lib.optionals isPy27 [ google-apputils ]; @@ -41,32 +39,20 @@ buildPythonPackage { cd python ''; - preConfigure = lib.optionalString (lib.versionAtLeast protobuf.version "2.6.0") '' - export PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION=cpp - export PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION_VERSION=2 - ''; + setupPyGlobalFlags = lib.optional (lib.versionAtLeast protobuf.version "2.6.0") + "--cpp_implementation"; - preBuild = '' - # Workaround for https://github.com/google/protobuf/issues/2895 - ${python.pythonForBuild.interpreter} setup.py build - '' + lib.optionalString (lib.versionAtLeast protobuf.version "2.6.0") '' - ${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 - ''; + pythonImportsCheck = [ + "google.protobuf" + ] ++ lib.optionals (lib.versionAtLeast protobuf.version "2.6.0") [ + "google.protobuf.internal._api_implementation" # Verify that --cpp_implementation worked + ]; meta = with lib; { description = "Protocol Buffers are Google's data interchange format"; homepage = "https://developers.google.com/protocol-buffers/"; license = licenses.bsd3; + maintainers = with maintainers; [ knedlsepp ]; }; passthru.protobuf = protobuf;