1{
2 lib,
3 aiohttp,
4 async-timeout,
5 buildPythonPackage,
6 fetchFromGitHub,
7 fetchpatch,
8 pytest-aiohttp,
9 pytestCheckHook,
10 pythonOlder,
11 setuptools,
12}:
13
14buildPythonPackage rec {
15 pname = "aiojobs";
16 version = "1.2.1";
17 format = "pyproject";
18
19 disabled = pythonOlder "3.8";
20
21 src = fetchFromGitHub {
22 owner = "aio-libs";
23 repo = "aiojobs";
24 rev = "refs/tags/v${version}";
25 hash = "sha256-LwFXb/SHP6bbqPg1tqYwE03FKHf4Mv1PPOxnPdESH0I=";
26 };
27
28 patches = [
29 (fetchpatch {
30 url = "https://github.com/aio-libs/aiojobs/commit/1b88049841397b01f88aee7d92174ac5a15217c1.patch";
31 hash = "sha256-b38Ipa29T6bEVsPe04ZO3WCcs6+0fOQDCJM+w8K1bVY=";
32 })
33 ];
34
35 postPatch = ''
36 substituteInPlace pytest.ini \
37 --replace "--cov=aiojobs/ --cov=tests/ --cov-report term" ""
38 '';
39
40 nativeBuildInputs = [ setuptools ];
41
42 propagatedBuildInputs = lib.optionals (pythonOlder "3.11") [ async-timeout ];
43
44 passthru.optional-dependencies = {
45 aiohttp = [ aiohttp ];
46 };
47
48 nativeCheckInputs = [
49 pytestCheckHook
50 pytest-aiohttp
51 ] ++ lib.flatten (builtins.attrValues passthru.optional-dependencies);
52
53 pythonImportsCheck = [ "aiojobs" ];
54
55 disabledTests = [
56 # RuntimeWarning: coroutine 'Scheduler._wait_failed' was never awaited
57 "test_scheduler_must_be_created_within_running_loop"
58 ];
59
60 __darwinAllowLocalNetworking = true;
61
62 meta = with lib; {
63 description = "Jobs scheduler for managing background task (asyncio)";
64 homepage = "https://github.com/aio-libs/aiojobs";
65 changelog = "https://github.com/aio-libs/aiojobs/blob/v${version}/CHANGES.rst";
66 license = licenses.asl20;
67 maintainers = with maintainers; [ cmcdragonkai ];
68 };
69}