about summary refs log tree commit diff
path: root/pkgs/development/libraries/thrift/default.nix
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/development/libraries/thrift/default.nix')
-rw-r--r--pkgs/development/libraries/thrift/default.nix56
1 files changed, 46 insertions, 10 deletions
diff --git a/pkgs/development/libraries/thrift/default.nix b/pkgs/development/libraries/thrift/default.nix
index f85e56578bbe8..f54288b5a3faa 100644
--- a/pkgs/development/libraries/thrift/default.nix
+++ b/pkgs/development/libraries/thrift/default.nix
@@ -1,5 +1,15 @@
-{ lib, stdenv, fetchurl, boost, zlib, libevent, openssl, python3, cmake, pkg-config
-, bison, flex
+{ lib
+, stdenv
+, fetchurl
+, boost
+, zlib
+, libevent
+, openssl
+, python3
+, cmake
+, pkg-config
+, bison
+, flex
 , static ? stdenv.hostPlatform.isStatic
 }:
 
@@ -12,15 +22,39 @@ stdenv.mkDerivation rec {
     sha256 = "sha256-9GC1wcow2JGP+V6j62KRs5Uc9RhVNWYIjz8r6JgfYgk=";
   };
 
-  # Workaround to make the python wrapper not drop this package:
+  # Workaround to make the Python wrapper not drop this package:
   # pythonFull.buildEnv.override { extraLibs = [ thrift ]; }
   pythonPath = [];
 
-  nativeBuildInputs = [ cmake pkg-config bison flex ];
-  buildInputs = [ boost zlib libevent openssl ]
-    ++ lib.optionals (!static) [ (python3.withPackages (ps: [ps.twisted])) ];
+  nativeBuildInputs = [
+    bison
+    cmake
+    flex
+    pkg-config
+  ];
+
+  buildInputs = [
+    boost
+    libevent
+    openssl
+    zlib
+  ] ++ lib.optionals (!static) [
+    (python3.withPackages (ps: [ps.twisted]))
+  ];
+
+  postPatch = ''
+    # Python 3.10 related failures:
+    # SystemError: PY_SSIZE_T_CLEAN macro must be defined for '#' formats
+    # AttributeError: module 'collections' has no attribute 'Hashable'
+    substituteInPlace test/py/RunClientServer.py \
+      --replace "'FastbinaryTest.py'," "" \
+      --replace "'TestEof.py'," "" \
+      --replace "'TestFrozen.py'," ""
+  '';
 
-  preConfigure = "export PY_PREFIX=$out";
+  preConfigure = ''
+    export PY_PREFIX=$out
+  '';
 
   patches = [
     # ToStringTest.cpp is failing from some reason due to locale issue, this
@@ -43,12 +77,12 @@ stdenv.mkDerivation rec {
   disabledTests = [
     "PythonTestSSLSocket"
   ] ++ lib.optionals stdenv.isDarwin [
-    # tests that hang up in the darwin sandbox
+    # Tests that hang up in the Darwin sandbox
     "SecurityTest"
     "SecurityFromBufferTest"
     "python_test"
 
-    # tests that fail in the darwin sandbox when trying to use network
+    # Tests that fail in the Darwin sandbox when trying to use network
     "UnitTests"
     "TInterruptTest"
     "TServerIntegrationTest"
@@ -62,6 +96,7 @@ stdenv.mkDerivation rec {
   ];
 
   doCheck = !static;
+
   checkPhase = ''
     runHook preCheck
 
@@ -69,6 +104,7 @@ stdenv.mkDerivation rec {
 
     runHook postCheck
   '';
+
   enableParallelChecking = false;
 
   meta = with lib; {
@@ -76,6 +112,6 @@ stdenv.mkDerivation rec {
     homepage = "https://thrift.apache.org/";
     license = licenses.asl20;
     platforms = platforms.linux ++ platforms.darwin;
-    maintainers = [ maintainers.bjornfor ];
+    maintainers = with maintainers; [ bjornfor ];
   };
 }