1{
2 lib,
3 buildPythonPackage,
4 fetchPypi,
5 fetchpatch,
6 flit-core,
7 dos2unix,
8 httpx,
9 pytest-asyncio,
10 pytest-mock,
11 pytestCheckHook,
12 pythonOlder,
13}:
14
15buildPythonPackage rec {
16 pname = "zeversolarlocal";
17 version = "1.1.0";
18 format = "pyproject";
19
20 disabled = pythonOlder "3.7";
21
22 src = fetchPypi {
23 inherit pname version;
24 sha256 = "ExZy5k5RE7k+D0lGmuIkGWrWQ+m24K2oqbUEg4BAVuY=";
25 };
26
27 nativeBuildInputs = [
28 flit-core
29 dos2unix
30 ];
31
32 propagatedBuildInputs = [ httpx ];
33
34 nativeCheckInputs = [
35 pytest-asyncio
36 pytest-mock
37 pytestCheckHook
38 ];
39
40 # the patch below won't apply unless we fix the line endings
41 prePatch = ''
42 dos2unix pyproject.toml
43 '';
44
45 patches = [
46 # Raise the flit-core limit
47 # https://github.com/sander76/zeversolarlocal/pull/4
48 (fetchpatch {
49 url = "https://github.com/sander76/zeversolarlocal/commit/bff072ea046de07eced77bc79eb8e90dfef1f53f.patch";
50 hash = "sha256-tzFCwPzhAfwVfN5mLY/DMwRv7zGzx3ScBe+kKzkYcvo=";
51 })
52 ];
53
54 postPatch = ''
55 substituteInPlace pyproject.toml \
56 --replace "--cov zeversolarlocal --cov-report xml:cov.xml --cov-report term-missing -vv" ""
57 '';
58
59 disabledTests = [
60 # Test requires network access
61 "test_httpx_timeout"
62 ];
63
64 pythonImportsCheck = [ "zeversolarlocal" ];
65
66 meta = with lib; {
67 description = "Python module to interact with Zeversolar inverters";
68 homepage = "https://github.com/sander76/zeversolarlocal";
69 license = licenses.mit;
70 maintainers = with maintainers; [ fab ];
71 };
72}