about summary refs log tree commit diff
diff options
context:
space:
mode:
authorJörg Thalheim <joerg@thalheim.io>2024-06-17 17:02:59 +0200
committerRobert Schütz <mail@dotlambda.de>2024-06-19 07:56:39 -0700
commit935eb15442967e297e439f022af091c2b9fbdb61 (patch)
treeb14f74b4c97014d259c20d552e030a7086c093eb
parent4ee62639cdfa344a02c90108fc8a106bcd76f757 (diff)
python311Packages.deltachat2: init at 0.6.2
Co-authored-by: Sandro <sandro.jaeckel@gmail.com>
Co-authored-by: Robert Schütz <nix@dotlambda.de>
-rw-r--r--pkgs/development/python-modules/deltachat2/default.nix42
-rw-r--r--pkgs/development/python-modules/deltachat2/paths.patch13
-rw-r--r--pkgs/top-level/python-packages.nix2
3 files changed, 57 insertions, 0 deletions
diff --git a/pkgs/development/python-modules/deltachat2/default.nix b/pkgs/development/python-modules/deltachat2/default.nix
new file mode 100644
index 0000000000000..78d10679a3079
--- /dev/null
+++ b/pkgs/development/python-modules/deltachat2/default.nix
@@ -0,0 +1,42 @@
+{ lib
+, fetchFromGitHub
+, buildPythonPackage
+, deltachat-rpc-server
+, libdeltachat
+, setuptools-scm
+, substituteAll
+}:
+
+buildPythonPackage rec {
+  pname = "deltachat2";
+  version = "0.6.2";
+  pyproject = true;
+
+  src = fetchFromGitHub {
+    owner = "adbenitez";
+    repo = "deltachat2";
+    rev = "refs/tags/${version}";
+    hash = "sha256-bp4bi+EeMaWP8zOaPp0eaPKn71F055QgMOOSDzIJUH4=";
+  };
+
+  patches = [
+    (substituteAll {
+      src = ./paths.patch;
+      deltachatrpcserver = lib.getExe deltachat-rpc-server;
+    })
+  ];
+
+  build-system = [
+    setuptools-scm
+  ];
+
+  pythonImportsCheck = [ "deltachat2" ];
+
+  meta = {
+    description = "Client library for Delta Chat core JSON-RPC interface";
+    homepage = "https://github.com/adbenitez/deltachat2";
+    license = lib.licenses.mpl20;
+    mainProgram = "deltachat2";
+    inherit (libdeltachat.meta) maintainers;
+  };
+}
diff --git a/pkgs/development/python-modules/deltachat2/paths.patch b/pkgs/development/python-modules/deltachat2/paths.patch
new file mode 100644
index 0000000000000..92cfe11fc6f0e
--- /dev/null
+++ b/pkgs/development/python-modules/deltachat2/paths.patch
@@ -0,0 +1,13 @@
+diff --git a/deltachat2/transport.py b/deltachat2/transport.py
+index a93dc7e..251947b 100644
+--- a/deltachat2/transport.py
++++ b/deltachat2/transport.py
+@@ -71,7 +71,7 @@ class IOTransport:
+             # `process_group` is not supported before Python 3.11.
+             kwargs = {"preexec_fn": os.setpgrp, **self._kwargs}  # noqa: PLW1509
+         self.process = subprocess.Popen(  # noqa: R1732
+-            "deltachat-rpc-server",
++            "@deltachatrpcserver@",
+             stdin=subprocess.PIPE,
+             stdout=subprocess.PIPE,
+             **kwargs,
diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix
index 483cb05e69962..b14adb9f57831 100644
--- a/pkgs/top-level/python-packages.nix
+++ b/pkgs/top-level/python-packages.nix
@@ -2944,6 +2944,8 @@ self: super: with self; {
 
   deltachat = callPackage ../development/python-modules/deltachat { };
 
+  deltachat2 = callPackage ../development/python-modules/deltachat2 { };
+
   deluge-client = callPackage ../development/python-modules/deluge-client { };
 
   demes = callPackage ../development/python-modules/demes { };