1{
2 lib,
3 buildPythonPackage,
4 fetchFromGitHub,
5 fetchpatch,
6 mock,
7 pytest-asyncio,
8 pytestCheckHook,
9 pythonOlder,
10 six,
11}:
12
13buildPythonPackage rec {
14 pname = "promise";
15 version = "2.3.0";
16 format = "setuptools";
17
18 disabled = pythonOlder "3.7";
19
20 src = fetchFromGitHub {
21 owner = "syrusakbary";
22 repo = "promise";
23 tag = "v${version}";
24 hash = "sha256-5s6GMANSO4UpLOP/HAQxuNFSBSjPgvJCB9R1dOoKuJ4=";
25 };
26
27 patches = [
28 # Convert @asyncio.coroutine to async def, https://github.com/syrusakbary/promise/pull/99
29 (fetchpatch {
30 name = "use-async-def.patch";
31 url = "https://github.com/syrusakbary/promise/commit/3cde549d30b38dcff81b308e18c7f61783003791.patch";
32 hash = "sha256-XCbTo6RCv75nNrpbK3TFdV0h7tBJ0QK+WOAR8S8w9as=";
33 })
34 ];
35
36 postPatch = ''
37 substituteInPlace tests/test_extra.py \
38 --replace "assert_exc.traceback[-1].path.strpath" "str(assert_exc.traceback[-1].path)"
39 '';
40
41 propagatedBuildInputs = [ six ];
42
43 nativeCheckInputs = [
44 mock
45 pytest-asyncio
46 pytestCheckHook
47 ];
48
49 disabledTests = [
50 # Failed: async def functions are not natively supported
51 "test_issue_9_safe"
52 ];
53
54 disabledTestPaths = [ "tests/test_benchmark.py" ];
55
56 pythonImportsCheck = [ "promise" ];
57
58 meta = with lib; {
59 description = "Ultra-performant Promise implementation in Python";
60 homepage = "https://github.com/syrusakbary/promise";
61 changelog = "https://github.com/syrusakbary/promise/releases/tag/v${version}";
62 license = licenses.mit;
63 maintainers = with maintainers; [ kamadorueda ];
64 };
65}