nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{ lib
2, android-backup
3, appdirs
4, attrs
5, buildPythonPackage
6, click
7, construct
8, croniter
9, cryptography
10, defusedxml
11, fetchPypi
12, importlib-metadata
13, netifaces
14, poetry-core
15, pytest-mock
16, pytestCheckHook
17, pythonOlder
18, pytz
19, pyyaml
20, tqdm
21, zeroconf
22}:
23
24
25buildPythonPackage rec {
26 pname = "python-miio";
27 version = "0.5.11";
28 format = "pyproject";
29
30 disabled = pythonOlder "3.7";
31
32 src = fetchPypi {
33 inherit pname version;
34 sha256 = "sha256-1hC7yE/hGLx9g3NXqU45yC/6dcW6/0oZwgYW5bj/37c=";
35 };
36
37 nativeBuildInputs = [
38 poetry-core
39 ];
40
41 propagatedBuildInputs = [
42 android-backup
43 appdirs
44 attrs
45 click
46 construct
47 croniter
48 cryptography
49 defusedxml
50 netifaces
51 pytz
52 pyyaml
53 tqdm
54 zeroconf
55 ] ++ lib.optional (pythonOlder "3.8") [
56 importlib-metadata
57 ];
58
59 checkInputs = [
60 pytest-mock
61 pytestCheckHook
62 ];
63
64 postPatch = ''
65 substituteInPlace pyproject.toml \
66 --replace 'defusedxml = "^0"' 'defusedxml = "*"'
67 # Will be fixed with the next release, https://github.com/rytilahti/python-miio/pull/1378
68 substituteInPlace miio/integrations/vacuum/roborock/vacuum_cli.py \
69 --replace "resultcallback" "result_callback"
70 '';
71
72 pythonImportsCheck = [
73 "miio"
74 ];
75
76 meta = with lib; {
77 description = "Python library for interfacing with Xiaomi smart appliances";
78 homepage = "https://github.com/rytilahti/python-miio";
79 license = licenses.gpl3Only;
80 maintainers = with maintainers; [ flyfloh ];
81 };
82}