about summary refs log tree commit diff
path: root/pkgs/development/python-modules/paho-mqtt/default.nix
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/development/python-modules/paho-mqtt/default.nix')
-rw-r--r--pkgs/development/python-modules/paho-mqtt/default.nix63
1 files changed, 41 insertions, 22 deletions
diff --git a/pkgs/development/python-modules/paho-mqtt/default.nix b/pkgs/development/python-modules/paho-mqtt/default.nix
index 8c0e54d18d60..890cf28a7462 100644
--- a/pkgs/development/python-modules/paho-mqtt/default.nix
+++ b/pkgs/development/python-modules/paho-mqtt/default.nix
@@ -1,42 +1,61 @@
-{ lib
-, stdenv
-, buildPythonPackage
-, fetchFromGitHub
-, isPy3k
-, pytestCheckHook
-, mock
-, six
+{
+  lib,
+  stdenv,
+  buildPythonPackage,
+  pythonOlder,
+  fetchFromGitHub,
+  hatchling,
+  pytestCheckHook,
 }:
 
-buildPythonPackage rec {
+let
+  testing = fetchFromGitHub {
+    owner = "eclipse";
+    repo = "paho.mqtt.testing";
+    rev = "a4dc694010217b291ee78ee13a6d1db812f9babd";
+    hash = "sha256-SQoNdkWMjnasPjpXQF2yV97MUra8gb27pc3rNoA8Rjw=";
+  };
+in buildPythonPackage rec {
   pname = "paho-mqtt";
-  version = "1.6.1";
-  format = "setuptools";
+  version = "2.1.0";
+  pyproject = true;
+
+  disabled = pythonOlder "3.7";
 
   src = fetchFromGitHub {
     owner = "eclipse";
     repo = "paho.mqtt.python";
     rev = "v${version}";
-    hash = "sha256-9nH6xROVpmI+iTKXfwv2Ar1PAmWbEunI3HO0pZyK6Rg=";
+    hash = "sha256-VMq+WTW+njK34QUUTE6fR2j2OmHxVzR0wrC92zYb1rY=";
   };
 
+  build-system = [
+    hatchling
+  ];
+
   nativeCheckInputs = [
     pytestCheckHook
-    six
-  ] ++ lib.optionals (!isPy3k) [
-    mock
   ];
 
-  doCheck = !stdenv.isDarwin;
+  doCheck = !stdenv.hostPlatform.isDarwin;
 
-  pythonImportsCheck = [
-    "paho.mqtt"
-  ];
+  pythonImportsCheck = [ "paho.mqtt" ];
+
+  preCheck = ''
+    ln -s ${testing} paho.mqtt.testing
+
+    # paho.mqtt not in top-level dir to get caught by this
+    export PYTHONPATH=".:$PYTHONPATH"
+  '';
 
   meta = with lib; {
-    description = "MQTT version 3.1.1 client class";
+    changelog = "https://github.com/eclipse/paho.mqtt.python/blob/${src.rev}/ChangeLog.txt";
+    description = "MQTT version 5.0/3.1.1 client class";
     homepage = "https://eclipse.org/paho";
-    license = licenses.epl10;
-    maintainers = with maintainers; [ mog dotlambda ];
+    license = licenses.epl20;
+    maintainers = with maintainers; [
+      mog
+      dotlambda
+    ];
   };
 }