1{ lib
2, buildPythonPackage
3, fetchPypi
4, pythonAtLeast
5, nettools
6, glibcLocales
7, autobahn
8, cffi
9, click
10, hkdf
11, pynacl
12, spake2
13, tqdm
14, python
15, mock
16, ipaddress
17, humanize
18, pyopenssl
19, service-identity
20}:
21
22buildPythonPackage rec {
23 pname = "magic-wormhole";
24 version = "0.10.2";
25 name = "${pname}-${version}";
26
27 src = fetchPypi {
28 inherit pname version;
29 sha256 = "55a423247faee7a0644d25f37760495978cd494ba0274fefd8cd1fad493954ee";
30 };
31
32 checkInputs = [ mock ];
33 buildInputs = [ nettools glibcLocales ];
34 propagatedBuildInputs = [ autobahn cffi click hkdf pynacl spake2 tqdm ipaddress humanize pyopenssl service-identity ];
35
36 postPatch = ''
37 sed -i -e "s|'ifconfig'|'${nettools}/bin/ifconfig'|" src/wormhole/ipaddrs.py
38 sed -i -e "s|if (os.path.dirname(os.path.abspath(wormhole))|if not os.path.abspath(wormhole).startswith('/nix/store') and (os.path.dirname(os.path.abspath(wormhole))|" src/wormhole/test/test_scripts.py
39 # XXX: disable one test due to warning:
40 # setlocale: LC_ALL: cannot change locale (en_US.UTF-8)
41 sed -i -e "s|def test_text_subprocess|def skip_test_text_subprocess|" src/wormhole/test/test_scripts.py
42 '' + lib.optionalString (pythonAtLeast "3.3") ''
43 sed -i -e 's|"ipaddress",||' setup.py
44 '';
45
46 checkPhase = ''
47 export PATH="$PATH:$out/bin"
48 export LANG="en_US.UTF-8"
49 export LC_ALL="en_US.UTF-8"
50 ${python.interpreter} -m wormhole.test.run_trial wormhole
51 '';
52
53 meta = with lib; {
54 description = "Securely transfer data between computers";
55 homepage = https://github.com/warner/magic-wormhole;
56 license = licenses.mit;
57 maintainers = with maintainers; [ asymmetric ];
58 };
59}