1{ lib
2, amqtt
3, buildPythonPackage
4, fetchFromGitHub
5, orjson
6, paho-mqtt
7, poetry-core
8, pytest-asyncio
9, pytestCheckHook
10, pythonOlder
11}:
12
13buildPythonPackage rec {
14 pname = "roombapy";
15 version = "1.6.9";
16 format = "pyproject";
17
18 disabled = pythonOlder "3.7";
19
20 src = fetchFromGitHub {
21 owner = "pschmitt";
22 repo = "roombapy";
23 rev = "refs/tags/${version}";
24 hash = "sha256-Bu8wl5Qtys1sy5FnB+2NCGnXnuq9u+TUUR9zNdlOFTU=";
25 };
26
27 postPatch = ''
28 # hbmqtt was replaced by amqtt
29 substituteInPlace tests/test_roomba_integration.py \
30 --replace "from hbmqtt.broker import Broker" "from amqtt.broker import Broker"
31
32 substituteInPlace pyproject.toml \
33 --replace 'orjson = ">=3.8.7"' 'orjson = "*"'
34 '';
35
36 nativeBuildInputs = [
37 poetry-core
38 ];
39
40 propagatedBuildInputs = [
41 orjson
42 paho-mqtt
43 ];
44
45 nativeCheckInputs = [
46 amqtt
47 pytest-asyncio
48 pytestCheckHook
49 ];
50
51 disabledTestPaths = [
52 # Requires network access
53 "tests/test_discovery.py"
54 ];
55
56 disabledTests = [
57 # Test want to connect to a local MQTT broker
58 "test_roomba_connect"
59 ];
60
61 pythonImportsCheck = [
62 "roombapy"
63 ];
64
65 meta = with lib; {
66 description = "Python program and library to control Wi-Fi enabled iRobot Roombas";
67 homepage = "https://github.com/pschmitt/roombapy";
68 changelog = "https://github.com/pschmitt/roombapy/releases/tag/${version}";
69 license = licenses.mit;
70 maintainers = [ ];
71 };
72}