about summary refs log tree commit diff
path: root/pkgs/development/python-modules/grpcio/default.nix
blob: dca383e92a6bd18d5afb2886050c64b26e013117 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
{
  lib,
  stdenv,
  buildPythonPackage,
  fetchPypi,
  grpc,
  six,
  protobuf,
  enum34 ? null,
  futures ? null,
  isPy27,
  pkg-config,
  cython,
  c-ares,
  openssl,
  zlib,
}:

buildPythonPackage rec {
  pname = "grpcio";
  format = "setuptools";
  version = "1.64.1";

  src = fetchPypi {
    inherit pname version;
    hash = "sha256-jVHdHFnV+g80JmuAo4BewpofJkJcKlRzYTP22H/Eloo=";
  };

  outputs = [
    "out"
    "dev"
  ];

  nativeBuildInputs = [
    cython
    pkg-config
  ];

  buildInputs = [
    c-ares
    openssl
    zlib
  ];
  propagatedBuildInputs =
    [
      six
      protobuf
    ]
    ++ lib.optionals (isPy27) [
      enum34
      futures
    ];

  preBuild =
    ''
      export GRPC_PYTHON_BUILD_EXT_COMPILER_JOBS="$NIX_BUILD_CORES"
      if [ -z "$enableParallelBuilding" ]; then
        GRPC_PYTHON_BUILD_EXT_COMPILER_JOBS=1
      fi
    ''
    + lib.optionalString stdenv.isDarwin ''
      unset AR
    '';

  GRPC_BUILD_WITH_BORING_SSL_ASM = "";
  GRPC_PYTHON_BUILD_SYSTEM_OPENSSL = 1;
  GRPC_PYTHON_BUILD_SYSTEM_ZLIB = 1;
  GRPC_PYTHON_BUILD_SYSTEM_CARES = 1;

  # does not contain any tests
  doCheck = false;

  enableParallelBuilding = true;

  pythonImportsCheck = [ "grpc" ];

  meta = with lib; {
    description = "HTTP/2-based RPC framework";
    license = licenses.asl20;
    homepage = "https://grpc.io/grpc/python/";
    maintainers = with maintainers; [ ];
  };
}