1{
2 lib,
3 aiohttp,
4 aresponses,
5 buildPythonPackage,
6 fetchFromGitHub,
7 poetry-core,
8 pytest-asyncio,
9 pytestCheckHook,
10 pythonOlder,
11 yarl,
12}:
13
14buildPythonPackage rec {
15 pname = "adguardhome";
16 version = "0.6.3";
17 format = "pyproject";
18
19 disabled = pythonOlder "3.11";
20
21 src = fetchFromGitHub {
22 owner = "frenck";
23 repo = "python-${pname}";
24 rev = "refs/tags/v${version}";
25 hash = "sha256-V8SsWsGYmUhR9/yV6BZBK1UjYGHlDrXrF8nt0eZbTnI=";
26 };
27
28 postPatch = ''
29 substituteInPlace pyproject.toml \
30 --replace "--cov" "" \
31 --replace '"0.0.0"' '"${version}"'
32
33 substituteInPlace tests/test_adguardhome.py \
34 --replace 0.0.0 ${version}
35 '';
36
37 nativeBuildInputs = [ poetry-core ];
38
39 propagatedBuildInputs = [
40 aiohttp
41 yarl
42 ];
43
44 __darwinAllowLocalNetworking = true;
45
46 nativeCheckInputs = [
47 aresponses
48 pytest-asyncio
49 pytestCheckHook
50 ];
51
52 pythonImportsCheck = [ "adguardhome" ];
53
54 meta = with lib; {
55 description = "Python client for the AdGuard Home API";
56 homepage = "https://github.com/frenck/python-adguardhome";
57 changelog = "https://github.com/frenck/python-adguardhome/releases/tag/v${version}";
58 license = licenses.mit;
59 maintainers = with maintainers; [ jamiemagee ];
60 };
61}