1{
2 lib,
3 aiohttp,
4 aioresponses,
5 buildPythonPackage,
6 fetchFromGitHub,
7 poetry-core,
8 pyroute2,
9 pytest-asyncio,
10 pytestCheckHook,
11 pythonOlder,
12}:
13
14buildPythonPackage rec {
15 pname = "unifi-discovery";
16 version = "1.2.0";
17 pyproject = true;
18
19 disabled = pythonOlder "3.9";
20
21 src = fetchFromGitHub {
22 owner = "bdraco";
23 repo = "unifi-discovery";
24 rev = "refs/tags/v${version}";
25 hash = "sha256-Ea+zxV2GUAaG/BxO103NhOLzzr/TNJaOsynDad2/2VA=";
26 };
27
28 postPatch = ''
29 substituteInPlace pyproject.toml \
30 --replace-fail "--cov=unifi_discovery --cov-report=term-missing:skip-covered" ""
31 '';
32
33 build-system = [ poetry-core ];
34
35 dependencies = [
36 aiohttp
37 pyroute2
38 ];
39
40 nativeCheckInputs = [
41 aioresponses
42 pytest-asyncio
43 pytestCheckHook
44 ];
45
46 pytestFlagsArray = [ "--asyncio-mode=auto" ];
47
48 pythonImportsCheck = [ "unifi_discovery" ];
49
50 meta = with lib; {
51 description = "Module to discover Unifi devices";
52 homepage = "https://github.com/bdraco/unifi-discovery";
53 changelog = "https://github.com/bdraco/unifi-discovery/releases/tag/v${version}";
54 license = with licenses; [ asl20 ];
55 maintainers = with maintainers; [ fab ];
56 platforms = platforms.linux;
57 };
58}