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