From 9d6738665745c9aacf1cf3d6743b517d0a973771 Mon Sep 17 00:00:00 2001 From: Vincent Haupert Date: Mon, 17 Oct 2022 19:29:31 +0200 Subject: [PATCH] python310Packages.pulumi: use `pulumi` instead of `pulumi-bin` --- .../python-modules/pulumi/default.nix | 65 ++++++++----------- pkgs/top-level/python-packages.nix | 2 +- 2 files changed, 27 insertions(+), 40 deletions(-) diff --git a/pkgs/development/python-modules/pulumi/default.nix b/pkgs/development/python-modules/pulumi/default.nix index 52a3cbcf91af..ad779eb2ffc4 100644 --- a/pkgs/development/python-modules/pulumi/default.nix +++ b/pkgs/development/python-modules/pulumi/default.nix @@ -1,42 +1,22 @@ { lib , buildPythonPackage -, fetchpatch , fetchFromGitHub , protobuf , dill , grpcio -, pulumi-bin +, pulumi , isPy27 , semver +, pytestCheckHook , pyyaml , six - - -# for tests -, go -, pulumictl -, pylint -, pytest -, pytest-timeout -, wheel -, pytest-asyncio - -, mypy }: -let - data = import ./data.nix {}; -in buildPythonPackage rec { - pname = "pulumi"; - version = pulumi-bin.version; - disabled = isPy27; + inherit (pulumi) version src; - src = fetchFromGitHub { - owner = "pulumi"; - repo = "pulumi"; - rev = "v${pulumi-bin.version}"; - sha256 = "sha256-vqEZEHTpJV65a3leWwYhyi3dzAsN67BXOvk5hnTPeuI="; - }; + pname = "pulumi"; + + disabled = isPy27; propagatedBuildInputs = [ semver @@ -48,28 +28,35 @@ buildPythonPackage rec { ]; checkInputs = [ - pulumi-bin - pulumictl - mypy - go - pytest - pytest-timeout - pytest-asyncio - wheel + pulumi.pkgs.pulumi-language-python + pytestCheckHook ]; - sourceRoot="source/sdk/python/lib"; + pytestFlagsArray = [ + "test/" + ]; + + sourceRoot = "source/sdk/python/lib"; + # we apply the modifications done in the pulumi/sdk/python/Makefile # but without the venv code postPatch = '' cp ../../README.md . - sed -i "s/\''${VERSION}/${version}/g" setup.py + substituteInPlace setup.py \ + --replace "3.0.0" "${version}" \ + --replace "grpcio==1.47" "grpcio" ''; - # disabled because tests try to fetch go packages from the net - doCheck = false; + # Allow local networking in tests on Darwin + __darwinAllowLocalNetworking = true; - pythonImportsCheck = ["pulumi"]; + # 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"; diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix index ee5d53204f0c..327536a97f2b 100644 --- a/pkgs/top-level/python-packages.nix +++ b/pkgs/top-level/python-packages.nix @@ -1070,7 +1070,7 @@ self: super: with self; { pad4pi = callPackage ../development/python-modules/pad4pi { }; - pulumi = callPackage ../development/python-modules/pulumi { }; + pulumi = callPackage ../development/python-modules/pulumi { inherit (pkgs) pulumi; }; pulumi-aws = callPackage ../development/python-modules/pulumi-aws { };