1{
2 lib,
3 aiohttp,
4 aresponses,
5 backoff,
6 buildPythonPackage,
7 fetchFromGitHub,
8 packaging,
9 poetry-core,
10 pydantic,
11 pytest-asyncio,
12 pytest-mock,
13 pytestCheckHook,
14 pythonOlder,
15 yarl,
16}:
17
18buildPythonPackage rec {
19 pname = "python-bsblan";
20 version = "0.5.18";
21 format = "pyproject";
22
23 disabled = pythonOlder "3.9";
24
25 src = fetchFromGitHub {
26 owner = "liudger";
27 repo = pname;
28 rev = "refs/tags/v${version}";
29 hash = "sha256-SJUIJhsVn4LZiUx9h3Q2uWoeaQiKoIRrijTfPgCHnAA=";
30 };
31
32 postPatch = ''
33 substituteInPlace pyproject.toml \
34 --replace 'version = "0.0.0"' 'version = "${version}"' \
35 --replace "--cov" ""
36 sed -i "/covdefaults/d" pyproject.toml
37 sed -i "/ruff/d" pyproject.toml
38 '';
39
40 nativeBuildInputs = [ poetry-core ];
41
42 propagatedBuildInputs = [
43 aiohttp
44 backoff
45 packaging
46 pydantic
47 yarl
48 ];
49
50 nativeCheckInputs = [
51 aresponses
52 pytest-asyncio
53 pytest-mock
54 pytestCheckHook
55 ];
56
57 disabledTests = lib.optionals (lib.versionAtLeast aiohttp.version "3.9.0") [
58 # https://github.com/liudger/python-bsblan/issues/808
59 "test_http_error400"
60 "test_not_authorized_401_response"
61 ];
62
63 pythonImportsCheck = [ "bsblan" ];
64
65 meta = with lib; {
66 description = "Module to control and monitor an BSBLan device programmatically";
67 homepage = "https://github.com/liudger/python-bsblan";
68 changelog = "https://github.com/liudger/python-bsblan/releases/tag/v${version}";
69 license = with licenses; [ mit ];
70 maintainers = with maintainers; [ fab ];
71 };
72}