mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-01-27 07:14:52 +00:00
Merge pull request #325951 from mjoerg/magic-wormhole-python-3.12
magic-wormhole: make usable with Python 3.12
This commit is contained in:
commit
ae20d8d61a
@ -1,18 +1,27 @@
|
||||
{ config, lib, pkgs, ... }:
|
||||
|
||||
with lib;
|
||||
{
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
|
||||
let
|
||||
cfg = config.services.magic-wormhole-mailbox-server;
|
||||
# keep semicolon in dataDir for backward compatibility
|
||||
dataDir = "/var/lib/magic-wormhole-mailbox-server;";
|
||||
python = pkgs.python3.withPackages (py: [ py.magic-wormhole-mailbox-server py.twisted ]);
|
||||
python = pkgs.python311.withPackages (
|
||||
py: with py; [
|
||||
magic-wormhole-mailbox-server
|
||||
twisted
|
||||
]
|
||||
);
|
||||
in
|
||||
{
|
||||
options.services.magic-wormhole-mailbox-server = {
|
||||
enable = mkEnableOption "Magic Wormhole Mailbox Server";
|
||||
enable = lib.mkEnableOption "Magic Wormhole Mailbox Server";
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
config = lib.mkIf cfg.enable {
|
||||
systemd.services.magic-wormhole-mailbox-server = {
|
||||
after = [ "network.target" ];
|
||||
wantedBy = [ "multi-user.target" ];
|
||||
@ -23,6 +32,7 @@ in
|
||||
StateDirectory = baseNameOf dataDir;
|
||||
};
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
meta.maintainers = [ lib.maintainers.mjoerg ];
|
||||
}
|
||||
|
@ -21,9 +21,6 @@ buildPythonPackage rec {
|
||||
version = "0.4.1";
|
||||
pyproject = true;
|
||||
|
||||
# python 3.12 support: https://github.com/magic-wormhole/magic-wormhole-mailbox-server/issues/41
|
||||
disabled = pythonOlder "3.7" || pythonAtLeast "3.12";
|
||||
|
||||
src = fetchPypi {
|
||||
inherit pname version;
|
||||
hash = "sha256-GvEFkpCcqvUZwA5wbqyELF53+NQ1YhX+nGHHsiWKiPs=";
|
||||
@ -38,13 +35,14 @@ buildPythonPackage rec {
|
||||
})
|
||||
];
|
||||
|
||||
nativeBuildInputs = [ setuptools ];
|
||||
build-system = [ setuptools ];
|
||||
|
||||
propagatedBuildInputs = [
|
||||
dependencies = [
|
||||
attrs
|
||||
autobahn
|
||||
setuptools # pkg_resources is referenced at runtime
|
||||
six
|
||||
twisted
|
||||
autobahn
|
||||
] ++ autobahn.optional-dependencies.twisted ++ twisted.optional-dependencies.tls;
|
||||
|
||||
pythonImportsCheck = [ "wormhole_mailbox_server" ];
|
||||
@ -66,5 +64,7 @@ buildPythonPackage rec {
|
||||
changelog = "https://github.com/magic-wormhole/magic-wormhole-mailbox-server/blob/${version}/NEWS.md";
|
||||
license = lib.licenses.mit;
|
||||
maintainers = [ lib.maintainers.mjoerg ];
|
||||
# Python 3.12 support: https://github.com/magic-wormhole/magic-wormhole-mailbox-server/issues/41
|
||||
broken = pythonOlder "3.7" || pythonAtLeast "3.12";
|
||||
};
|
||||
}
|
||||
|
@ -16,17 +16,16 @@ buildPythonPackage rec {
|
||||
version = "0.2.1";
|
||||
pyproject = true;
|
||||
|
||||
disabled = pythonOlder "3.7" || pythonAtLeast "3.12";
|
||||
|
||||
src = fetchPypi {
|
||||
inherit pname version;
|
||||
hash = "sha256-y0gBtGiQ6v+XKG4OP+xi0dUv/jF9FACDtjNqH7To+l4=";
|
||||
};
|
||||
|
||||
nativeBuildInputs = [ setuptools ];
|
||||
build-system = [ setuptools ];
|
||||
|
||||
propagatedBuildInputs = [
|
||||
dependencies = [
|
||||
autobahn
|
||||
setuptools # pkg_resources is referenced at runtime
|
||||
twisted
|
||||
];
|
||||
|
||||
@ -38,11 +37,15 @@ buildPythonPackage rec {
|
||||
twisted
|
||||
];
|
||||
|
||||
__darwinAllowLocalNetworking = true;
|
||||
|
||||
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";
|
||||
};
|
||||
}
|
||||
|
@ -44,20 +44,32 @@ buildPythonPackage rec {
|
||||
hash = "sha256-AG0jn4i/98N7wu/2CgBOJj+vklj3J5GS0Gugyc7WsIA=";
|
||||
};
|
||||
|
||||
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.isLinux ''
|
||||
sed -i -e "s|'ifconfig'|'${nettools}/bin/ifconfig'|" src/wormhole/ipaddrs.py
|
||||
'';
|
||||
|
||||
propagatedBuildInputs = [
|
||||
spake2
|
||||
pynacl
|
||||
six
|
||||
build-system = [ setuptools ];
|
||||
|
||||
dependencies = [
|
||||
attrs
|
||||
twisted
|
||||
autobahn
|
||||
automat
|
||||
tqdm
|
||||
click
|
||||
humanize
|
||||
iterable-io
|
||||
pynacl
|
||||
six
|
||||
spake2
|
||||
tqdm
|
||||
twisted
|
||||
txtorcon
|
||||
zipstream-ng
|
||||
] ++ autobahn.optional-dependencies.twisted ++ twisted.optional-dependencies.tls;
|
||||
@ -66,43 +78,33 @@ buildPythonPackage rec {
|
||||
dilation = [ noiseprotocol ];
|
||||
};
|
||||
|
||||
nativeCheckInputs = [
|
||||
mock
|
||||
magic-wormhole-transit-relay
|
||||
magic-wormhole-mailbox-server
|
||||
pytestCheckHook
|
||||
] ++ passthru.optional-dependencies.dilation ++ lib.optionals stdenv.isDarwin [ unixtools.locale ];
|
||||
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.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"
|
||||
];
|
||||
__darwinAllowLocalNetworking = true;
|
||||
|
||||
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"
|
||||
];
|
||||
|
||||
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
|
||||
|
Loading…
Reference in New Issue
Block a user