1{ lib
2, stdenv
3, buildPythonPackage
4, fetchPypi
5, fetchpatch
6, six
7, attrs
8, twisted
9, pyopenssl
10, service-identity
11, autobahn
12, treq
13, mock
14, pythonOlder
15}:
16
17buildPythonPackage rec {
18 pname = "magic-wormhole-mailbox-server";
19 version = "0.4.1";
20 format = "setuptools";
21
22 disabled = pythonOlder "3.7";
23
24 src = fetchPypi {
25 inherit pname version;
26 sha256 = "1af10592909caaf519c00e706eac842c5e77f8d4356215fe9c61c7b2258a88fb";
27 };
28
29 patches = [
30 (fetchpatch {
31 # Remove the 'U' open mode removed, https://github.com/magic-wormhole/magic-wormhole-mailbox-server/pull/34
32 name = "fix-for-python-3.11.patch";
33 url = "https://github.com/magic-wormhole/magic-wormhole-mailbox-server/commit/4b358859ba80de37c3dc0a5f67ec36909fd48234.patch";
34 hash = "sha256-RzZ5kD+xhmFYusVzAbGE+CODXtJVR1zN2rZ+VGApXiQ=";
35 })
36 ];
37
38 propagatedBuildInputs = [
39 attrs
40 six
41 twisted
42 autobahn
43 ] ++ autobahn.optional-dependencies.twisted
44 ++ twisted.optional-dependencies.tls;
45
46 nativeCheckInputs = [
47 treq
48 mock
49 twisted
50 ];
51
52 # Fails in Darwin's sandbox
53 postPatch = lib.optionalString stdenv.isDarwin ''
54 echo 'LogRequests.skip = "Operation not permitted"' >> src/wormhole_mailbox_server/test/test_web.py
55 echo 'WebSocketAPI.skip = "Operation not permitted"' >> src/wormhole_mailbox_server/test/test_web.py
56 '';
57
58 checkPhase = ''
59 trial -j$NIX_BUILD_CORES wormhole_mailbox_server
60 '';
61
62 meta = with lib; {
63 description = "Securely transfer data between computers";
64 homepage = "https://github.com/warner/magic-wormhole-mailbox-server";
65 changelog = "https://github.com/magic-wormhole/magic-wormhole-mailbox-server/blob/${version}/NEWS.md";
66 license = licenses.mit;
67 maintainers = with maintainers; [ ];
68 };
69}