1{
2 lib,
3 aiohttp,
4 buildPythonPackage,
5 fetchFromGitHub,
6 fetchpatch,
7 pytestCheckHook,
8 pythonOlder,
9 pythonAtLeast,
10 poetry-core,
11 pytest-aiohttp,
12 pytest-asyncio,
13}:
14
15buildPythonPackage rec {
16 pname = "hyperion-py";
17 version = "0.7.5";
18 disabled = pythonOlder "3.8";
19 format = "pyproject";
20
21 src = fetchFromGitHub {
22 owner = "dermotduffy";
23 repo = pname;
24 rev = "v${version}";
25 hash = "sha256-arcnpCQsRuiWCrAz/t4TCjTe8DRDtRuzYp8k7nnjGDk=";
26 };
27
28 patches = [
29 (fetchpatch {
30 # python3.10 compat: Drop loop kwarg in asyncio.sleep call
31 url = "https://github.com/dermotduffy/hyperion-py/commit/f02af52fcce17888984c99bfc03935e372011394.patch";
32 hash = "sha256-4nfsQVxd77VV9INwNxTyFRDlAjwdTYqfSGuF487hFCs=";
33 })
34 ];
35
36 nativeBuildInputs = [ poetry-core ];
37
38 propagatedBuildInputs = [ aiohttp ];
39
40 nativeCheckInputs = [
41 pytest-asyncio
42 pytest-aiohttp
43 pytestCheckHook
44 ];
45
46 pytestFlagsArray = [
47 # pytest-asyncio 0.17.0 compat
48 "--asyncio-mode=auto"
49 ];
50
51 postPatch = ''
52 substituteInPlace pyproject.toml \
53 --replace " --timeout=9 --cov=hyperion" ""
54 '';
55
56 pythonImportsCheck = [ "hyperion" ];
57
58 meta = with lib; {
59 description = "Python package for Hyperion Ambient Lighting";
60 homepage = "https://github.com/dermotduffy/hyperion-py";
61 license = licenses.mit;
62 maintainers = with maintainers; [ fab ];
63 };
64}