From 7e3b8ad4905b42ba884e964d925468cf20c10644 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sandro=20J=C3=A4ckel?= Date: Thu, 6 Oct 2022 11:21:59 +0200 Subject: [PATCH] python310Packages.protobuf: remove old and no longer required code --- .../python-modules/protobuf/default.nix | 50 ++++++------------- pkgs/top-level/python-packages.nix | 2 - 2 files changed, 16 insertions(+), 36 deletions(-) diff --git a/pkgs/development/python-modules/protobuf/default.nix b/pkgs/development/python-modules/protobuf/default.nix index ee1d0bbffb5a..cc7ea3c7bdc3 100644 --- a/pkgs/development/python-modules/protobuf/default.nix +++ b/pkgs/development/python-modules/protobuf/default.nix @@ -1,41 +1,14 @@ { buildPackages , lib -, fetchpatch -, python , buildPythonPackage -, isPy37 , protobuf -, google-apputils ? null -, six , pyext -, isPy27 -, disabled -, doCheck ? true +, isPyPy }: buildPythonPackage { inherit (protobuf) pname src version; - inherit disabled; - doCheck = doCheck && !isPy27; # setuptools>=41.4 no longer collects correctly on python2 - - propagatedBuildInputs = [ six ] ++ lib.optionals isPy27 [ google-apputils ]; - propagatedNativeBuildInputs = let - protobufVersion = "${lib.versions.major protobuf.version}_${lib.versions.minor protobuf.version}"; - in [ - buildPackages."protobuf${protobufVersion}" # For protoc of the same version. - ]; - - nativeBuildInputs = [ pyext ] ++ lib.optionals isPy27 [ google-apputils ]; - buildInputs = [ protobuf ]; - - patches = lib.optional (isPy37 && (lib.versionOlder protobuf.version "3.6.1.2")) - # Python 3.7 compatibility (not needed for protobuf >= 3.6.1.2) - (fetchpatch { - url = "https://github.com/protocolbuffers/protobuf/commit/0a59054c30e4f0ba10f10acfc1d7f3814c63e1a7.patch"; - sha256 = "09hw22y3423v8bbmc9xm07znwdxfbya6rp78d4zqw6fisdvjkqf1"; - stripLen = 1; - }) - ; + disabled = isPyPy; prePatch = '' while [ ! -d python ]; do @@ -44,21 +17,30 @@ buildPythonPackage { cd python ''; - setupPyGlobalFlags = lib.optional (lib.versionAtLeast protobuf.version "2.6.0") - "--cpp_implementation"; + nativeBuildInputs = [ pyext ]; + + buildInputs = [ protobuf ]; + + propagatedNativeBuildInputs = [ + # For protoc of the same version. + buildPackages."protobuf${lib.versions.major protobuf.version}_${lib.versions.minor protobuf.version}" + ]; + + setupPyGlobalFlags = "--cpp_implementation"; pythonImportsCheck = [ "google.protobuf" - ] ++ lib.optionals (lib.versionAtLeast protobuf.version "2.6.0") [ "google.protobuf.internal._api_implementation" # Verify that --cpp_implementation worked ]; + passthru = { + inherit protobuf; + }; + 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; } diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix index 98e7c6c5f273..3afcba240464 100644 --- a/pkgs/top-level/python-packages.nix +++ b/pkgs/top-level/python-packages.nix @@ -7330,9 +7330,7 @@ in { proto-plus = callPackage ../development/python-modules/proto-plus { }; protobuf = callPackage ../development/python-modules/protobuf { - disabled = isPyPy; # If a protobuf upgrade causes many Python packages to fail, please pin it here to the previous version. - doCheck = !isPy3k; inherit (pkgs) protobuf; };