summaryrefslogtreecommitdiff
path: root/pkgs/development/python-modules/aria2p/default.nix
blob: abf7de6b29b7f3d2272773c2755f98ef986da78a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
{
  lib,
  stdenv,
  buildPythonPackage,
  fetchFromGitHub,
  pdm-backend,
  loguru,
  platformdirs,
  requests,
  setuptools,
  toml,
  websocket-client,
  asciimatics,
  pyperclip,
  aria2,
  fastapi,
  psutil,
  pytest-xdist,
  pytestCheckHook,
  responses,
  uvicorn,

  withTui ? true,
}:

buildPythonPackage rec {
  pname = "aria2p";
  version = "0.12.1";
  pyproject = true;

  src = fetchFromGitHub {
    owner = "pawamoy";
    repo = "aria2p";
    tag = version;
    hash = "sha256-JEXTCDfFjxI1hooiEQq0KIGGoS2F7fyzOM0GMl+Jr7w=";
  };

  build-system = [ pdm-backend ];

  dependencies = [
    loguru
    platformdirs
    requests
    setuptools # for pkg_resources
    toml
    websocket-client
  ]
  ++ lib.optionals withTui optional-dependencies.tui;

  optional-dependencies = {
    tui = [
      asciimatics
      pyperclip
    ];
  };

  preCheck = ''
    export HOME=$TMPDIR
  '';

  nativeCheckInputs = [
    aria2
    fastapi
    pytest-xdist
    pytestCheckHook
    responses
    psutil
    uvicorn
  ]
  ++ optional-dependencies.tui;

  disabledTests = [
    # require a running display server
    "test_add_downloads_torrents_and_metalinks"
    "test_add_downloads_uris"
    # require a running aria2 server
    "test_cli_autoclear_commands"
    "test_get_files_method"
    "test_pause_subcommand"
    "test_resume_method"
  ];

  pythonImportsCheck = [ "aria2p" ];

  meta = {
    homepage = "https://github.com/pawamoy/aria2p";
    changelog = "https://github.com/pawamoy/aria2p/blob/${src.tag}/CHANGELOG.md";
    description = "Command-line tool and library to interact with an aria2c daemon process with JSON-RPC";
    mainProgram = "aria2p";
    license = lib.licenses.isc;
    maintainers = with lib.maintainers; [ koral ];
    badPlatforms = [
      lib.systems.inspect.patterns.isDarwin
    ];
  };
}