1{
2 lib,
3 stdenv,
4 buildPythonPackage,
5 pythonOlder,
6 fetchFromGitHub,
7 hatchling,
8 pytestCheckHook,
9}:
10
11let
12 testing = fetchFromGitHub {
13 owner = "eclipse";
14 repo = "paho.mqtt.testing";
15 rev = "a4dc694010217b291ee78ee13a6d1db812f9babd";
16 hash = "sha256-SQoNdkWMjnasPjpXQF2yV97MUra8gb27pc3rNoA8Rjw=";
17 };
18in
19buildPythonPackage rec {
20 pname = "paho-mqtt";
21 version = "2.1.0";
22 pyproject = true;
23
24 disabled = pythonOlder "3.7";
25
26 src = fetchFromGitHub {
27 owner = "eclipse";
28 repo = "paho.mqtt.python";
29 rev = "v${version}";
30 hash = "sha256-VMq+WTW+njK34QUUTE6fR2j2OmHxVzR0wrC92zYb1rY=";
31 };
32
33 build-system = [
34 hatchling
35 ];
36
37 nativeCheckInputs = [
38 pytestCheckHook
39 ];
40
41 __darwinAllowLocalNetworking = true;
42
43 pythonImportsCheck = [ "paho.mqtt" ];
44
45 preCheck = ''
46 ln -s ${testing} paho.mqtt.testing
47
48 # paho.mqtt not in top-level dir to get caught by this
49 export PYTHONPATH=".:$PYTHONPATH"
50 '';
51
52 meta = with lib; {
53 changelog = "https://github.com/eclipse/paho.mqtt.python/blob/${src.rev}/ChangeLog.txt";
54 description = "MQTT version 5.0/3.1.1 client class";
55 homepage = "https://eclipse.org/paho";
56 license = licenses.epl20;
57 maintainers = with maintainers; [
58 mog
59 dotlambda
60 ];
61 };
62}