From ff7d9a3e054ce0cf48919f6c6e0ad1a969ff91d0 Mon Sep 17 00:00:00 2001 From: Martin Joerg Date: Sat, 26 Oct 2024 13:45:35 +0000 Subject: [PATCH 1/2] python312Packages.magic-wormhole-transit-relay: 0.2.1 -> 0.3.1 https://github.com/magic-wormhole/magic-wormhole-transit-relay/compare/refs/tags/0.2.1...refs/tags/0.3.1 --- .../magic-wormhole-transit-relay/default.nix | 21 +++++++---- .../python-modules/magic-wormhole/default.nix | 36 ++++++++++++++++--- 2 files changed, 46 insertions(+), 11 deletions(-) diff --git a/pkgs/development/python-modules/magic-wormhole-transit-relay/default.nix b/pkgs/development/python-modules/magic-wormhole-transit-relay/default.nix index bf8b990fe0d9d..89366bc43f1da 100644 --- a/pkgs/development/python-modules/magic-wormhole-transit-relay/default.nix +++ b/pkgs/development/python-modules/magic-wormhole-transit-relay/default.nix @@ -6,21 +6,27 @@ autobahn, mock, twisted, - pythonOlder, - pythonAtLeast, + python, pytestCheckHook, }: buildPythonPackage rec { pname = "magic-wormhole-transit-relay"; - version = "0.2.1"; + version = "0.3.1"; pyproject = true; src = fetchPypi { inherit pname version; - hash = "sha256-y0gBtGiQ6v+XKG4OP+xi0dUv/jF9FACDtjNqH7To+l4="; + hash = "sha256-LvLvvk008OYkhw+EIln9czuncVLtMQr0NJd0piiEkA4="; }; + postPatch = '' + # Passing the environment to twistd is necessary to preserve Python's site path. + substituteInPlace src/wormhole_transit_relay/test/test_backpressure.py --replace-fail \ + 'reactor.spawnProcess(proto, exe, args)' \ + 'reactor.spawnProcess(proto, exe, args, None)' + ''; + build-system = [ setuptools ]; dependencies = [ @@ -39,13 +45,16 @@ buildPythonPackage rec { __darwinAllowLocalNetworking = true; + postCheck = '' + # Avoid collision with twisted's plugin cache (#164775). + rm "$out/${python.sitePackages}/twisted/plugins/dropin.cache" + ''; + meta = { description = "Transit Relay server for Magic-Wormhole"; homepage = "https://github.com/magic-wormhole/magic-wormhole-transit-relay"; changelog = "https://github.com/magic-wormhole/magic-wormhole-transit-relay/blob/${version}/NEWS.md"; license = lib.licenses.mit; maintainers = [ lib.maintainers.mjoerg ]; - # Python 3.12 support: https://github.com/magic-wormhole/magic-wormhole-transit-relay/issues/35 - broken = pythonOlder "3.7" || pythonAtLeast "3.12"; }; } diff --git a/pkgs/development/python-modules/magic-wormhole/default.nix b/pkgs/development/python-modules/magic-wormhole/default.nix index 5abdff45c6d16..6d64ee1a4c4e0 100644 --- a/pkgs/development/python-modules/magic-wormhole/default.nix +++ b/pkgs/development/python-modules/magic-wormhole/default.nix @@ -3,6 +3,7 @@ stdenv, buildPythonPackage, fetchPypi, + pythonAtLeast, # build-system setuptools, @@ -34,6 +35,27 @@ pytestCheckHook, }: +let + # magic-wormhole relies on the internal API of + # magic-wormhole-transit-relay < 0.3.0 for testing. + magic-wormhole-transit-relay_0_2_1 = + magic-wormhole-transit-relay.overridePythonAttrs + (oldAttrs: rec { + version = "0.2.1"; + + src = fetchPypi { + pname = "magic-wormhole-transit-relay"; + inherit version; + hash = "sha256-y0gBtGiQ6v+XKG4OP+xi0dUv/jF9FACDtjNqH7To+l4="; + }; + + postPatch = ""; + + postCheck = ""; + + meta.broken = pythonAtLeast "3.12"; + }); +in buildPythonPackage rec { pname = "magic-wormhole"; version = "0.16.0"; @@ -81,8 +103,12 @@ buildPythonPackage rec { 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 ] + lib.optionals + (!magic-wormhole-mailbox-server.meta.broken && !magic-wormhole-transit-relay_0_2_1.meta.broken) + [ + magic-wormhole-mailbox-server + magic-wormhole-transit-relay_0_2_1 + ] ++ [ mock pytestCheckHook @@ -96,15 +122,15 @@ buildPythonPackage rec { # 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) + (magic-wormhole-mailbox-server.meta.broken || magic-wormhole-transit-relay_0_2_1.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_transit.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 From 254e934ead21842c2964bd5ba310ae1fcae952fe Mon Sep 17 00:00:00 2001 From: Martin Joerg Date: Sat, 26 Oct 2024 13:45:35 +0000 Subject: [PATCH 2/2] python312Packages.magic-wormhole: 0.16.0 -> 0.17.0 https://github.com/magic-wormhole/magic-wormhole/compare/refs/tags/0.16.0...refs/tags/0.17.0 --- .../python-modules/magic-wormhole/default.nix | 40 +++++-------------- 1 file changed, 10 insertions(+), 30 deletions(-) diff --git a/pkgs/development/python-modules/magic-wormhole/default.nix b/pkgs/development/python-modules/magic-wormhole/default.nix index 6d64ee1a4c4e0..87404ab5b21e2 100644 --- a/pkgs/development/python-modules/magic-wormhole/default.nix +++ b/pkgs/development/python-modules/magic-wormhole/default.nix @@ -2,8 +2,7 @@ lib, stdenv, buildPythonPackage, - fetchPypi, - pythonAtLeast, + fetchFromGitHub, # build-system setuptools, @@ -35,35 +34,16 @@ pytestCheckHook, }: -let - # magic-wormhole relies on the internal API of - # magic-wormhole-transit-relay < 0.3.0 for testing. - magic-wormhole-transit-relay_0_2_1 = - magic-wormhole-transit-relay.overridePythonAttrs - (oldAttrs: rec { - version = "0.2.1"; - - src = fetchPypi { - pname = "magic-wormhole-transit-relay"; - inherit version; - hash = "sha256-y0gBtGiQ6v+XKG4OP+xi0dUv/jF9FACDtjNqH7To+l4="; - }; - - postPatch = ""; - - postCheck = ""; - - meta.broken = pythonAtLeast "3.12"; - }); -in buildPythonPackage rec { pname = "magic-wormhole"; - version = "0.16.0"; + version = "0.17.0"; pyproject = true; - src = fetchPypi { - inherit pname version; - hash = "sha256-FObBRomNvaem0ZAmJiOmlBmVU2Pn5DTWSq0tIz1tlMk="; + src = fetchFromGitHub { + owner = "magic-wormhole"; + repo = "magic-wormhole"; + rev = "refs/tags/${version}"; + hash = "sha256-BxPF4iQ91wLBagdvQ/Y89VIZBkMxFiEHnK+BU55Bwr4="; }; postPatch = @@ -104,10 +84,10 @@ buildPythonPackage rec { # 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-transit-relay_0_2_1.meta.broken) + (!magic-wormhole-mailbox-server.meta.broken && !magic-wormhole-transit-relay.meta.broken) [ magic-wormhole-mailbox-server - magic-wormhole-transit-relay_0_2_1 + magic-wormhole-transit-relay ] ++ [ mock @@ -122,7 +102,7 @@ buildPythonPackage rec { # 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_0_2_1.meta.broken) + (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"