1{ lib
2, buildPythonPackage
3, deprecated
4, fetchFromGitHub
5, fetchpatch
6, poetry-core
7, pytestCheckHook
8, pythonOlder
9, requests
10, requests-mock
11}:
12
13buildPythonPackage rec {
14 pname = "openevsewifi";
15 version = "1.1.2";
16 format = "pyproject";
17
18 disabled = pythonOlder "3.7";
19
20 src = fetchFromGitHub {
21 owner = "miniconfig";
22 repo = "python-openevse-wifi";
23 rev = "v${version}";
24 hash = "sha256-7+BC5WG0JoyHNjgsoJBQRVDpmdXMJCV4bMf6pIaS5qo=";
25 };
26
27 nativeBuildInputs = [
28 poetry-core
29 ];
30
31 propagatedBuildInputs = [
32 deprecated
33 requests
34 ];
35
36 nativeCheckInputs = [
37 requests-mock
38 pytestCheckHook
39 ];
40
41 patches = [
42 # Switch to poetry-core, https://github.com/miniconfig/python-openevse-wifi/pull/31
43 (fetchpatch {
44 name = "switch-to-poetry-core.patch";
45 url = "https://github.com/miniconfig/python-openevse-wifi/commit/1083868dd9f39a8ad7bb17f02cea1b8458e5b82d.patch";
46 hash = "sha256-XGeyi/PchBju1ICgL/ZCDGCbWwIJmLAcHuKaj+kDsI0=";
47 })
48 ];
49
50 postPatch = ''
51 substituteInPlace pyproject.toml \
52 --replace 'pytest-cov = "^2.8.1"' ""
53 '';
54
55 pythonImportsCheck = [
56 "openevsewifi"
57 ];
58
59 meta = with lib; {
60 description = "Module for communicating with the wifi module from OpenEVSE";
61 homepage = "https://github.com/miniconfig/python-openevse-wifi";
62 license = with licenses; [ mit ];
63 maintainers = with maintainers; [ fab ];
64 };
65}