1{ lib
2, buildPythonPackage
3, fetchFromGitHub
4, fetchpatch
5, mock
6, pytest-asyncio
7, pytestCheckHook
8, pythonOlder
9, six
10}:
11
12buildPythonPackage rec {
13 pname = "promise";
14 version = "2.3.0";
15 format = "setuptools";
16
17 disabled = pythonOlder "3.7";
18
19 src = fetchFromGitHub {
20 owner = "syrusakbary";
21 repo = "promise";
22 rev = "refs/tags/v${version}";
23 hash = "sha256-5s6GMANSO4UpLOP/HAQxuNFSBSjPgvJCB9R1dOoKuJ4=";
24 };
25
26 patches = [
27 # Convert @asyncio.coroutine to async def, https://github.com/syrusakbary/promise/pull/99
28 (fetchpatch {
29 name = "use-async-def.patch";
30 url = "https://github.com/syrusakbary/promise/commit/3cde549d30b38dcff81b308e18c7f61783003791.patch";
31 hash = "sha256-XCbTo6RCv75nNrpbK3TFdV0h7tBJ0QK+WOAR8S8w9as=";
32 })
33 ];
34
35 postPatch = ''
36 substituteInPlace tests/test_extra.py \
37 --replace "assert_exc.traceback[-1].path.strpath" "str(assert_exc.traceback[-1].path)"
38 '';
39
40 propagatedBuildInputs = [
41 six
42 ];
43
44 nativeCheckInputs = [
45 mock
46 pytest-asyncio
47 pytestCheckHook
48 ];
49
50 disabledTestPaths = [
51 "tests/test_benchmark.py"
52 ];
53
54 pythonImportsCheck = [
55 "promise"
56 ];
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}