1{ lib, buildPythonPackage, fetchFromGitHub, pythonOlder
2, aria2, poetry, pytest, pytest-cov, pytest-xdist, responses
3, asciimatics, loguru, requests, setuptools, websocket-client
4}:
5
6buildPythonPackage rec {
7 pname = "aria2p";
8 version = "0.9.1";
9 format = "pyproject";
10 disabled = pythonOlder "3.6";
11
12 src = fetchFromGitHub {
13 owner = "pawamoy";
14 repo = pname;
15 rev = "v${version}";
16 sha256 = "1s4kad6jnfz9p64gkqclkfq2x2bn8dbc0hyr86d1545bgn7pz672";
17 };
18
19 nativeBuildInputs = [ poetry ];
20
21 preBuild = ''
22 export HOME=$TMPDIR
23 '';
24
25 checkInputs = [ aria2 responses pytest pytest-cov pytest-xdist ];
26
27 # Tests are not all stable/deterministic,
28 # they rely on actually running an aria2c daemon and communicating with it,
29 # race conditions and deadlocks were observed,
30 # thus the corresponding tests are disabled
31 checkPhase = ''
32 pytest -nauto -k "not test_api and not test_cli and not test_interface"
33 '';
34
35 propagatedBuildInputs = [ asciimatics loguru requests setuptools websocket-client ];
36
37 meta = with lib; {
38 homepage = "https://github.com/pawamoy/aria2p";
39 description = "Command-line tool and library to interact with an aria2c daemon process with JSON-RPC";
40 license = licenses.isc;
41 maintainers = with maintainers; [ koral ];
42 };
43}