1{
2 lib,
3 buildPythonPackage,
4 aiohttp,
5 async-timeout,
6 chacha20poly1305-reuseable,
7 cryptography,
8 deepdiff,
9 fetchFromGitHub,
10 ifaddr,
11 mediafile,
12 miniaudio,
13 protobuf,
14 pydantic,
15 pyfakefs,
16 pytest-aiohttp,
17 pytest-asyncio,
18 pytest-httpserver,
19 pytest-timeout,
20 pytestCheckHook,
21 pythonRelaxDepsHook,
22 pythonAtLeast,
23 pythonOlder,
24 requests,
25 setuptools,
26 srptools,
27 stdenv,
28 tabulate,
29 zeroconf,
30}:
31
32buildPythonPackage rec {
33 pname = "pyatv";
34 version = "0.14.5";
35 pyproject = true;
36
37 disabled = pythonOlder "3.8";
38
39 src = fetchFromGitHub {
40 owner = "postlund";
41 repo = "pyatv";
42 rev = "refs/tags/v${version}";
43 hash = "sha256-Uykj9MIUFcZyTWOBjUhL9+qItbnpwtuTd2Cx5jI7Wtw=";
44 };
45
46 postPatch = ''
47 substituteInPlace setup.py \
48 --replace "pytest-runner" ""
49 '';
50
51 pythonRelaxDeps = [
52 "aiohttp"
53 "async_timeout"
54 "bitarray"
55 "chacha20poly1305-reuseable"
56 "cryptography"
57 "ifaddr"
58 "mediafile"
59 "miniaudio"
60 "protobuf"
61 "requests"
62 "srptools"
63 "zeroconf"
64 ];
65
66 nativeBuildInputs = [
67 pythonRelaxDepsHook
68 setuptools
69 ];
70
71 propagatedBuildInputs = [
72 aiohttp
73 async-timeout
74 chacha20poly1305-reuseable
75 cryptography
76 ifaddr
77 mediafile
78 miniaudio
79 protobuf
80 pydantic
81 requests
82 srptools
83 tabulate
84 zeroconf
85 ];
86
87 nativeCheckInputs = [
88 deepdiff
89 pyfakefs
90 pytest-aiohttp
91 pytest-asyncio
92 pytest-httpserver
93 pytest-timeout
94 pytestCheckHook
95 ];
96
97 disabledTests =
98 [
99 # https://github.com/postlund/pyatv/issues/2307
100 "test_zeroconf_service_published"
101 ]
102 ++ lib.optionals (pythonAtLeast "3.12") [
103 # https://github.com/postlund/pyatv/issues/2365
104 "test_simple_dispatch"
105 ]
106 ++ lib.optionals (stdenv.isDarwin) [
107 # tests/protocols/raop/test_raop_functional.py::test_stream_retransmission[raop_properties2-2-True] - assert False
108 "test_stream_retransmission"
109 ];
110
111 disabledTestPaths = [
112 # Test doesn't work in the sandbox
113 "tests/protocols/companion/test_companion_auth.py"
114 "tests/protocols/mrp/test_mrp_auth.py"
115 ];
116
117 __darwinAllowLocalNetworking = true;
118
119 pythonImportsCheck = [ "pyatv" ];
120
121 meta = with lib; {
122 description = "Python client library for the Apple TV";
123 homepage = "https://github.com/postlund/pyatv";
124 changelog = "https://github.com/postlund/pyatv/blob/v${version}/CHANGES.md";
125 license = licenses.mit;
126 maintainers = with maintainers; [ fab ];
127 };
128}