1{ lib
2, aiohttp
3, aresponses
4, buildPythonPackage
5, fetchFromGitHub
6, fetchpatch
7, poetry-core
8, pytest-asyncio
9, pytestCheckHook
10, pythonOlder
11, yarl
12}:
13
14buildPythonPackage rec {
15 pname = "autarco";
16 version = "0.2.0";
17 format = "pyproject";
18
19 disabled = pythonOlder "3.9";
20
21 src = fetchFromGitHub {
22 owner = "klaasnicolaas";
23 repo = "python-autarco";
24 rev = "v${version}";
25 hash = "sha256-3f6N4b6WZPAUUQTuGeb20q0f7ZqDR+O24QRze5RpRlw=";
26 };
27
28 patches = [
29 # https://github.com/klaasnicolaas/python-autarco/pull/265
30 (fetchpatch {
31 name = "remove-setuptools-dependency.patch";
32 url = "https://github.com/klaasnicolaas/python-autarco/commit/bf40e8a4f64cd9c9cf72930260895537ea5b2adc.patch";
33 hash = "sha256-Fgijy7sd67LUIqh3qjQjyothnjdW7Zcil/bQSuVsBR8=";
34 })
35 ];
36
37 postPatch = ''
38 # Upstream doesn't set a version for the pyproject.toml
39 substituteInPlace pyproject.toml \
40 --replace "0.0.0" "${version}" \
41 --replace "--cov" ""
42 '';
43
44 nativeBuildInputs = [
45 poetry-core
46 ];
47
48 propagatedBuildInputs = [
49 aiohttp
50 yarl
51 ];
52
53 __darwinAllowLocalNetworking = true;
54
55 nativeCheckInputs = [
56 aresponses
57 pytest-asyncio
58 pytestCheckHook
59 ];
60
61 pythonImportsCheck = [
62 "autarco"
63 ];
64
65 meta = with lib; {
66 description = "Module for the Autarco Inverter";
67 homepage = "https://github.com/klaasnicolaas/python-autarco";
68 license = with licenses; [ mit ];
69 maintainers = with maintainers; [ fab ];
70 };
71}