1{ lib, stdenv
2, buildPythonPackage
3, grpc
4, six
5, protobuf
6, enum34 ? null
7, futures ? null
8, isPy27
9, pkg-config
10, cython
11, c-ares
12, openssl
13, zlib
14}:
15
16buildPythonPackage rec {
17 inherit (grpc) src version;
18 pname = "grpcio";
19 format = "setuptools";
20
21 outputs = [ "out" "dev" ];
22
23 nativeBuildInputs = [ cython pkg-config ];
24
25 buildInputs = [ c-ares openssl zlib ];
26 propagatedBuildInputs = [ six protobuf ]
27 ++ lib.optionals (isPy27) [ enum34 futures ];
28
29 preBuild = ''
30 export GRPC_PYTHON_BUILD_EXT_COMPILER_JOBS="$NIX_BUILD_CORES"
31 if [ -z "$enableParallelBuilding" ]; then
32 GRPC_PYTHON_BUILD_EXT_COMPILER_JOBS=1
33 fi
34 '' + lib.optionalString stdenv.isDarwin ''
35 unset AR
36 '';
37
38 GRPC_BUILD_WITH_BORING_SSL_ASM = "";
39 GRPC_PYTHON_BUILD_SYSTEM_OPENSSL = 1;
40 GRPC_PYTHON_BUILD_SYSTEM_ZLIB = 1;
41 GRPC_PYTHON_BUILD_SYSTEM_CARES = 1;
42
43 # does not contain any tests
44 doCheck = false;
45
46 enableParallelBuilding = true;
47
48 pythonImportsCheck = [ "grpc" ];
49
50 meta = with lib; {
51 description = "HTTP/2-based RPC framework";
52 license = licenses.asl20;
53 homepage = "https://grpc.io/grpc/python/";
54 maintainers = with maintainers; [ ];
55 };
56}