about summary refs log tree commit diff
path: root/nixpkgs/pkgs/development/python-modules/envoy-reader/default.nix
blob: a327c3f457d2987050ac9f7baaa616cab0c1009f (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
{ lib
, buildPythonPackage
, envoy-utils
, fetchFromGitHub
, fetchpatch
, httpx
, pytest-asyncio
, pytest-raises
, pytestCheckHook
, respx
}:

buildPythonPackage rec {
  pname = "envoy-reader";
  version = "0.20.0";
  format = "setuptools";

  src = fetchFromGitHub {
    owner = "jesserizzo";
    repo = "envoy_reader";
    rev = version;
    sha256 = "sha256-nPB1Fvb1qwLHeFkXP2jXixD2ZGA09MtS1qXRhYGt0fM=";
  };

  propagatedBuildInputs = [
    envoy-utils
    httpx
  ];

  checkInputs = [
    pytest-raises
    pytest-asyncio
    pytestCheckHook
    respx
  ];

  postPatch = ''
    substituteInPlace setup.py \
      --replace "pytest-runner>=5.2" ""
  '';

  patches = [
    # Support for later httpx, https://github.com/jesserizzo/envoy_reader/pull/82
    (fetchpatch {
      name = "support-later-httpx.patch";
      url = "https://github.com/jesserizzo/envoy_reader/commit/6019a89419fe9c830ba839be7d39ec54725268b0.patch";
      sha256 = "17vsrx13rskvh8swvjisb2dk6x1jdbjcm8ikkpidia35pa24h272";
    })
  ];

  pythonImportsCheck = [
    "envoy_reader"
  ];

  meta = with lib; {
    description = "Python module to read from Enphase Envoy units";
    homepage = "https://github.com/jesserizzo/envoy_reader";
    license = licenses.mit;
    maintainers = with maintainers; [ fab ];
  };
}