about summary refs log tree commit diff
path: root/pkgs/development/python-modules/pulumi/default.nix
blob: b61bc41505db4087ac6d89c2aaf3302f1c7cc611 (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
{ lib
, buildPythonPackage
, protobuf
, dill
, grpcio
, pulumi
, isPy27
, semver
, pip
, pytestCheckHook
, pyyaml
, six
}:
buildPythonPackage rec {
  inherit (pulumi) version src;

  pname = "pulumi";
  format = "setuptools";

  disabled = isPy27;

  propagatedBuildInputs = [
    semver
    protobuf
    dill
    grpcio
    pyyaml
    six
  ];

  nativeCheckInputs = [
    pip
    pulumi.pkgs.pulumi-language-python
    pytestCheckHook
  ];

  pytestFlagsArray = [
    "test/"
  ];

  sourceRoot = "${src.name}/sdk/python/lib";

  # we apply the modifications done in the pulumi/sdk/python/Makefile
  # but without the venv code
  postPatch = ''
    cp ../../README.md .
    substituteInPlace setup.py \
      --replace "3.0.0" "${version}" \
      --replace "grpcio==1.56.2" "grpcio" \
      --replace "semver~=2.13" "semver"
  '';

  # Allow local networking in tests on Darwin
  __darwinAllowLocalNetworking = true;

  # Verify that the version substitution works
  preCheck = ''
    pip show "${pname}" | grep "Version: ${version}" > /dev/null \
      || (echo "ERROR: Version substitution seems to be broken"; exit 1)
  '';

  pythonImportsCheck = [ "pulumi" ];

  meta = with lib; {
    description = "Modern Infrastructure as Code. Any cloud, any language";
    homepage = "https://github.com/pulumi/pulumi";
    license = licenses.asl20;
    maintainers = with maintainers; [ teto ];
  };
}