summaryrefslogtreecommitdiff
path: root/pkgs/development/python-modules/libpurecool/default.nix
blob: 48d3b74c49db259927c2faddf21b68d5882ff307 (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
{
  lib,
  buildPythonPackage,
  fetchPypi,
  setuptools,
  netifaces,
  paho-mqtt,
  pycryptodome,
  requests,
  six,
  zeroconf,
}:

buildPythonPackage rec {
  pname = "libpurecool";
  version = "0.6.4";
  pyproject = true;

  src = fetchPypi {
    inherit pname version;
    sha256 = "1kwbinbg0i4fca1bpx6jwa1fiw71vg0xa89jhq4pmnl5cn9c8kqx";
  };

  # Remove vendorized zeroconf, https://github.com/etheralm/libpurecool/issues/33
  postPatch = ''
    rm libpurecool/zeroconf.py
    substituteInPlace libpurecool/dyson_pure_cool_link.py \
      --replace-fail "from .zeroconf import ServiceBrowser, Zeroconf" "from zeroconf import ServiceBrowser, Zeroconf"
  '';

  build-system = [ setuptools ];

  dependencies = [
    netifaces
    paho-mqtt
    pycryptodome
    requests
    six
    zeroconf
  ];

  # Tests are only present in repo, https://github.com/etheralm/libpurecool/issues/36
  doCheck = false;
  pythonImportsCheck = [ "libpurecool" ];

  meta = {
    description = "Python library for Dyson devices";
    homepage = "http://libpurecool.readthedocs.io";
    license = with lib.licenses; [ asl20 ];
    maintainers = with lib.maintainers; [ fab ];
  };
}