summary refs log tree commit diff
path: root/pkgs/development/python-modules/openevsewifi/default.nix
blob: b42e9c86bbe12a32cd5f5c55c32b470280ae1406 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
{ lib
, buildPythonPackage
, deprecated
, fetchFromGitHub
, fetchpatch
, poetry-core
, pytestCheckHook
, pythonOlder
, requests
, requests-mock
}:

buildPythonPackage rec {
  pname = "openevsewifi";
  version = "1.1.0";
  format = "pyproject";

  disabled = pythonOlder "3.7";

  src = fetchFromGitHub {
    owner = "miniconfig";
    repo = "python-openevse-wifi";
    rev = "v${version}";
    sha256 = "sha256-pNm+zupBGijCXIkdanMk7nE/+SFvSEFp9/Ht5OoxQrU=";
  };

  nativeBuildInputs = [
    poetry-core
  ];

  propagatedBuildInputs = [
    deprecated
    requests
  ];

  checkInputs = [
    requests-mock
    pytestCheckHook
  ];

  patches = [
    # Switch to poetry-core, https://github.com/miniconfig/python-openevse-wifi/pull/31
    (fetchpatch {
      name = "switch-to-poetry-core.patch";
      url = "https://github.com/miniconfig/python-openevse-wifi/commit/1083868dd9f39a8ad7bb17f02cea1b8458e5b82d.patch";
      sha256 = "sha256-XGeyi/PchBju1ICgL/ZCDGCbWwIJmLAcHuKaj+kDsI0=";
    })
  ];

  postPatch = ''
    substituteInPlace pyproject.toml \
      --replace 'pytest-cov = "^2.8.1"' ""
  '';

  pythonImportsCheck = [
    "openevsewifi"
  ];

  meta = with lib; {
    description = "Module for communicating with the wifi module from OpenEVSE";
    homepage = "https://github.com/miniconfig/python-openevse-wifi";
    license = with licenses; [ mit ];
    maintainers = with maintainers; [ fab ];
  };
}