1{
2 lib,
3 buildPythonPackage,
4 fetchFromGitHub,
5 pythonOlder,
6 pdm-backend,
7 loguru,
8 platformdirs,
9 requests,
10 setuptools,
11 toml,
12 websocket-client,
13 asciimatics,
14 pyperclip,
15 aria2,
16 fastapi,
17 psutil,
18 pytest-xdist,
19 pytestCheckHook,
20 responses,
21 uvicorn,
22}:
23
24buildPythonPackage rec {
25 pname = "aria2p";
26 version = "0.12.1";
27 format = "pyproject";
28 disabled = pythonOlder "3.6";
29
30 src = fetchFromGitHub {
31 owner = "pawamoy";
32 repo = pname;
33 tag = version;
34 hash = "sha256-JEXTCDfFjxI1hooiEQq0KIGGoS2F7fyzOM0GMl+Jr7w=";
35 };
36
37 build-system = [ pdm-backend ];
38
39 dependencies = [
40 loguru
41 platformdirs
42 requests
43 setuptools # for pkg_resources
44 toml
45 websocket-client
46 ];
47
48 optional-dependencies = {
49 tui = [
50 asciimatics
51 pyperclip
52 ];
53 };
54
55 preCheck = ''
56 export HOME=$TMPDIR
57 '';
58
59 nativeCheckInputs = [
60 aria2
61 fastapi
62 pytest-xdist
63 pytestCheckHook
64 responses
65 psutil
66 uvicorn
67 ] ++ optional-dependencies.tui;
68
69 disabledTests = [
70 # require a running display server
71 "test_add_downloads_torrents_and_metalinks"
72 "test_add_downloads_uris"
73 # require a running aria2 server
74 "test_cli_autoclear_commands"
75 "test_get_files_method"
76 "test_pause_subcommand"
77 "test_resume_method"
78 ];
79
80 pythonImportsCheck = [ "aria2p" ];
81
82 meta = with lib; {
83 homepage = "https://github.com/pawamoy/aria2p";
84 changelog = "https://github.com/pawamoy/aria2p/blob/${src.tag}/CHANGELOG.md";
85 description = "Command-line tool and library to interact with an aria2c daemon process with JSON-RPC";
86 mainProgram = "aria2p";
87 license = licenses.isc;
88 maintainers = with maintainers; [ koral ];
89 };
90}