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