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