summaryrefslogtreecommitdiff
path: root/pkgs/development/python-modules/promise/default.nix
blob: b05acc05aa8abd864713fd8fc1b31e5dc9cb07bc (plain)
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
{
  lib,
  buildPythonPackage,
  fetchFromGitHub,
  fetchpatch,
  mock,
  pytest-asyncio,
  pytestCheckHook,
  six,
}:

buildPythonPackage rec {
  pname = "promise";
  version = "2.3.0";
  format = "setuptools";

  src = fetchFromGitHub {
    owner = "syrusakbary";
    repo = "promise";
    tag = "v${version}";
    hash = "sha256-5s6GMANSO4UpLOP/HAQxuNFSBSjPgvJCB9R1dOoKuJ4=";
  };

  patches = [
    # Convert @asyncio.coroutine to async def, https://github.com/syrusakbary/promise/pull/99
    (fetchpatch {
      name = "use-async-def.patch";
      url = "https://github.com/syrusakbary/promise/commit/3cde549d30b38dcff81b308e18c7f61783003791.patch";
      hash = "sha256-XCbTo6RCv75nNrpbK3TFdV0h7tBJ0QK+WOAR8S8w9as=";
    })
  ];

  postPatch = ''
    substituteInPlace tests/test_extra.py \
      --replace "assert_exc.traceback[-1].path.strpath" "str(assert_exc.traceback[-1].path)"
  '';

  propagatedBuildInputs = [ six ];

  nativeCheckInputs = [
    mock
    pytest-asyncio
    pytestCheckHook
  ];

  disabledTests = [
    # Failed: async def functions are not natively supported
    "test_issue_9_safe"
  ];

  disabledTestPaths = [ "tests/test_benchmark.py" ];

  pythonImportsCheck = [ "promise" ];

  meta = {
    description = "Ultra-performant Promise implementation in Python";
    homepage = "https://github.com/syrusakbary/promise";
    changelog = "https://github.com/syrusakbary/promise/releases/tag/v${version}";
    license = lib.licenses.mit;
    maintainers = with lib.maintainers; [ kamadorueda ];
  };
}