aboutsummaryrefslogtreecommitdiff
path: root/infra/libkookie/nixpkgs/pkgs/development/python-modules/python-miio/default.nix
blob: 136483761cf8cce84b51453b7959212e093ae9a0 (plain)
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
{ stdenv
, buildPythonPackage
, fetchPypi
, appdirs
, click
, construct
, croniter
, cryptography
, importlib-metadata
, pytest
, pytest-mock
, zeroconf
, attrs
, pytz
, tqdm
, netifaces
}:


buildPythonPackage rec {
  pname = "python-miio";
  version = "0.5.4";

  src = fetchPypi {
    inherit pname version;
    sha256 = "5a6fd3bb2cc2f75cdfe5673f36a5a418144d08add6e53b384cb146e99f27bd39";
  };

  postPatch = ''
    substituteInPlace setup.py \
      --replace  "zeroconf>=0.25.1,<0.26.0" "zeroconf"
    substituteInPlace setup.py \
      --replace  "pytz>=2019.3,<2020.0" "pytz"
    substituteInPlace setup.py \
      --replace  "cryptography>=2.9,<3.0" "cryptography"
    '';

  checkInputs = [ pytest pytest-mock];
  propagatedBuildInputs = [ appdirs click construct croniter cryptography importlib-metadata zeroconf attrs pytz tqdm netifaces ];

  checkPhase = ''
    pytest
  '';

  meta = with stdenv.lib; {
    description = "Python library for interfacing with Xiaomi smart appliances";
    homepage = "https://github.com/rytilahti/python-miio";
    license = licenses.gpl3;
    maintainers = with maintainers; [ flyfloh ];
  };
}