1{
2 lib,
3 cython,
4 async-timeout,
5 buildPythonPackage,
6 fetchFromGitHub,
7 ifaddr,
8 poetry-core,
9 pytest-asyncio,
10 pytest-timeout,
11 pythonOlder,
12 pytestCheckHook,
13 setuptools,
14}:
15
16buildPythonPackage rec {
17 pname = "zeroconf";
18 version = "0.132.2";
19 pyproject = true;
20
21 disabled = pythonOlder "3.8";
22
23 src = fetchFromGitHub {
24 owner = "jstasiak";
25 repo = "python-zeroconf";
26 rev = "refs/tags/${version}";
27 hash = "sha256-Jmz9zs//EVdBbEElq6OEfGZiOiMvjV5CJxZOM/lHvok=";
28 };
29
30 postPatch = ''
31 substituteInPlace pyproject.toml \
32 --replace-fail "Cython>=3.0.8" "Cython"
33 '';
34
35 build-system = [
36 cython
37 poetry-core
38 setuptools
39 ];
40
41 dependencies = [ ifaddr ] ++ lib.optionals (pythonOlder "3.11") [ async-timeout ];
42
43 nativeCheckInputs = [
44 pytest-asyncio
45 pytest-timeout
46 pytestCheckHook
47 ];
48
49 preCheck = ''
50 sed -i '/addopts/d' pyproject.toml
51 '';
52
53 disabledTests = [
54 # OSError: [Errno 19] No such device
55 "test_close_multiple_times"
56 "test_integration_with_listener_ipv6"
57 "test_launch_and_close"
58 "test_launch_and_close_context_manager"
59 "test_launch_and_close_v4_v6"
60 ];
61
62 __darwinAllowLocalNetworking = true;
63
64 pythonImportsCheck = [
65 "zeroconf"
66 "zeroconf.asyncio"
67 ];
68
69 meta = with lib; {
70 description = "Python implementation of multicast DNS service discovery";
71 homepage = "https://github.com/python-zeroconf/python-zeroconf";
72 changelog = "https://github.com/python-zeroconf/python-zeroconf/releases/tag/${version}";
73 license = licenses.lgpl21Only;
74 maintainers = with maintainers; [ abbradar ];
75 };
76}