summaryrefslogtreecommitdiff
path: root/pkgs/development/python-modules/pytautulli/default.nix
blob: 39de443d3b4b5a6c49693d39762c3bf7a4937d69 (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
{
  lib,
  aiohttp,
  aresponses,
  buildPythonPackage,
  fetchFromGitHub,
  pytest-asyncio,
  pytestCheckHook,
  setuptools,
}:

buildPythonPackage rec {
  pname = "pytautulli";
  version = "23.1.1";
  pyproject = true;

  src = fetchFromGitHub {
    owner = "ludeeus";
    repo = "pytautulli";
    tag = version;
    hash = "sha256-5wE8FjLFu1oQkVqnWsbp253dsQ1/QGWC6hHSIFwLajY=";
  };

  postPatch = ''
    # Upstream is releasing with the help of a CI to PyPI, GitHub releases
    # are not in their focus
    substituteInPlace setup.py \
      --replace-fail 'version="main",' 'version="${version}",'

    # yarl 1.9.4 requires ports to be ints
    substituteInPlace pytautulli/models/host_configuration.py \
      --replace-fail "str(self.port)" "int(self.port)"

    # https://github.com/ludeeus/pytautulli/pull/44
    substituteInPlace pytautulli/decorator.py \
      --replace-fail "import async_timeout" ""
  '';

  build-system = [ setuptools ];

  dependencies = [ aiohttp ];

  nativeCheckInputs = [ pytestCheckHook ];

  checkInputs = [
    aresponses
    pytest-asyncio
  ];

  disabledTests = [
    # api url mismatch (port missing)
    "test_api_url"
  ];

  pythonImportsCheck = [ "pytautulli" ];

  meta = {
    description = "Python module to get information from Tautulli";
    homepage = "https://github.com/ludeeus/pytautulli";
    changelog = "https://github.com/ludeeus/pytautulli/releases/tag/${version}";
    license = with lib.licenses; [ mit ];
    maintainers = with lib.maintainers; [ fab ];
  };
}