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