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