about summary refs log tree commit diff
path: root/pkgs/development/python-modules/magic-wormhole
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/development/python-modules/magic-wormhole')
-rw-r--r--pkgs/development/python-modules/magic-wormhole/default.nix179
1 files changed, 91 insertions, 88 deletions
diff --git a/pkgs/development/python-modules/magic-wormhole/default.nix b/pkgs/development/python-modules/magic-wormhole/default.nix
index 353e2c0e053b0..0e6b95276c93b 100644
--- a/pkgs/development/python-modules/magic-wormhole/default.nix
+++ b/pkgs/development/python-modules/magic-wormhole/default.nix
@@ -1,122 +1,125 @@
-{ lib
-, stdenv
-, buildPythonPackage
-, fetchPypi
-
-# build-system
-, setuptools
-
-# dependencies
-, spake2
-, pynacl
-, six
-, attrs
-, twisted
-, autobahn
-, automat
-, tqdm
-, click
-, humanize
-, txtorcon
-
-# optional-dependencies
-, noiseprotocol
-
-# tests
-, nettools
-, unixtools
-, mock
-, magic-wormhole-transit-relay
-, magic-wormhole-mailbox-server
-, pytestCheckHook
+{
+  lib,
+  stdenv,
+  buildPythonPackage,
+  fetchPypi,
+
+  # build-system
+  setuptools,
+
+  # dependencies
+  spake2,
+  pynacl,
+  six,
+  attrs,
+  twisted,
+  autobahn,
+  automat,
+  tqdm,
+  click,
+  humanize,
+  iterable-io,
+  txtorcon,
+  zipstream-ng,
+
+  # optional-dependencies
+  noiseprotocol,
+
+  # tests
+  nettools,
+  unixtools,
+  mock,
+  magic-wormhole-transit-relay,
+  magic-wormhole-mailbox-server,
+  pytestCheckHook,
 }:
 
 buildPythonPackage rec {
   pname = "magic-wormhole";
-  version = "0.13.0";
-  format = "pyproject";
+  version = "0.15.0";
+  pyproject = true;
 
   src = fetchPypi {
     inherit pname version;
-    hash = "sha256-rDvWgoYnDn8UnAYUmo5Anl+jTX/rDoiESibSnu0tFRY=";
+    hash = "sha256-viVjtcVUe6MzvGYI8EgATI821VYTm/L/49n0HaJ5cAY=";
   };
 
-  nativeBuildInputs = [
-    setuptools
+  postPatch =
+    # enable tests by fixing the location of the wormhole binary
+    ''
+      substituteInPlace src/wormhole/test/test_cli.py --replace-fail \
+        'locations = procutils.which("wormhole")' \
+        'return "${placeholder "out"}/bin/wormhole"'
+    ''
+    # fix the location of the ifconfig binary
+    + lib.optionalString stdenv.hostPlatform.isLinux ''
+      sed -i -e "s|'ifconfig'|'${nettools}/bin/ifconfig'|" src/wormhole/ipaddrs.py
+    '';
+
+  build-system = [ setuptools ];
+
+  pythonRelaxDeps = [
+    "spake2"
   ];
 
-  propagatedBuildInputs = [
-    spake2
-    pynacl
-    six
+  dependencies = [
     attrs
-    twisted
     autobahn
     automat
-    tqdm
     click
     humanize
+    iterable-io
+    pynacl
+    six
+    spake2
+    tqdm
+    twisted
     txtorcon
-  ]
-  ++ autobahn.optional-dependencies.twisted
-  ++ twisted.optional-dependencies.tls;
+    zipstream-ng
+  ] ++ autobahn.optional-dependencies.twisted ++ twisted.optional-dependencies.tls;
 
   passthru.optional-dependencies = {
-    dilation = [
-      noiseprotocol
-    ];
+    dilation = [ noiseprotocol ];
   };
 
-  nativeCheckInputs = [
-    mock
-    magic-wormhole-transit-relay
-    magic-wormhole-mailbox-server
-    pytestCheckHook
-  ]
-  ++ passthru.optional-dependencies.dilation
-  ++ lib.optionals stdenv.isDarwin [ unixtools.locale ];
-
-  disabledTests = lib.optionals stdenv.isDarwin [
-    # These tests doesn't work within Darwin's sandbox
-    "test_version"
-    "test_text"
-    "test_receiver"
-    "test_sender"
-    "test_sender_allocation"
-    "test_text_wrong_password"
-    "test_override"
-    "test_allocate_port"
-    "test_allocate_port_no_reuseaddr"
-    "test_ignore_localhost_hint"
-    "test_ignore_localhost_hint_orig"
-    "test_keep_only_localhost_hint"
-    "test_get_direct_hints"
-    "test_listener"
-    "test_success_direct"
-    "test_direct"
-    "test_relay"
-  ];
+  nativeCheckInputs =
+    # For Python 3.12, remove magic-wormhole-mailbox-server and magic-wormhole-transit-relay from test dependencies,
+    # which are not yet supported with this version.
+    lib.optionals (!magic-wormhole-mailbox-server.meta.broken) [ magic-wormhole-mailbox-server ]
+    ++ lib.optionals (!magic-wormhole-transit-relay.meta.broken) [ magic-wormhole-transit-relay ]
+    ++ [
+      mock
+      pytestCheckHook
+    ]
+    ++ passthru.optional-dependencies.dilation
+    ++ lib.optionals stdenv.hostPlatform.isDarwin [ unixtools.locale ];
 
-  disabledTestPaths = lib.optionals stdenv.isDarwin [
-    # These tests doesn't work within Darwin's sandbox
-    "src/wormhole/test/test_xfer_util.py"
-    "src/wormhole/test/test_wormhole.py"
-  ];
+  __darwinAllowLocalNetworking = true;
 
-  postPatch = lib.optionalString stdenv.isLinux ''
-    sed -i -e "s|'ifconfig'|'${nettools}/bin/ifconfig'|" src/wormhole/ipaddrs.py
-  '';
+  disabledTestPaths =
+    # For Python 3.12, remove the tests depending on magic-wormhole-mailbox-server and magic-wormhole-transit-relay,
+    # which are not yet supported with this version.
+    lib.optionals
+      (magic-wormhole-mailbox-server.meta.broken || magic-wormhole-transit-relay.meta.broken)
+      [
+        "src/wormhole/test/dilate/test_full.py"
+        "src/wormhole/test/test_args.py"
+        "src/wormhole/test/test_cli.py"
+        "src/wormhole/test/test_wormhole.py"
+        "src/wormhole/test/test_xfer_util.py"
+      ]
+    ++ lib.optionals magic-wormhole-transit-relay.meta.broken [ "src/wormhole/test/test_transit.py" ];
 
   postInstall = ''
     install -Dm644 docs/wormhole.1 $out/share/man/man1/wormhole.1
   '';
 
-  meta = with lib; {
+  meta = {
     changelog = "https://github.com/magic-wormhole/magic-wormhole/blob/${version}/NEWS.md";
     description = "Securely transfer data between computers";
     homepage = "https://github.com/magic-wormhole/magic-wormhole";
-    license = licenses.mit;
-    maintainers = with maintainers; [ asymmetric ];
+    license = lib.licenses.mit;
+    maintainers = [ lib.maintainers.mjoerg ];
     mainProgram = "wormhole";
   };
 }