3
0
Fork 0
forked from mirrors/nixpkgs
nixpkgs/pkgs/development/python-modules/magic-wormhole/default.nix
Frederik Rietdijk 664ff4069c pythonPackages.magic-wormhole: fix build
- fixes build
- use buildPythonPackage and pass in individual packages

As mentioned in https://github.com/NixOS/nixpkgs/pull/20722 this
packages is both an application and a library.

If a package is both then we use buildPythonPackage and put it in
python-packages.nix. That way we can guarantee we use the correct
version of dependencies when using it as a library. Unfortunately, it
does mean the name of the package is prefixed with `pythonX.X-`.
2017-05-03 09:52:53 +02:00

53 lines
1.4 KiB
Nix

{ lib
, buildPythonPackage
, fetchPypi
, nettools
, glibcLocales
, autobahn
, cffi
, click
, hkdf
, pynacl
, spake2
, tqdm
, python
, mock
}:
buildPythonPackage rec {
pname = "magic-wormhole";
version = "0.8.1";
name = "${pname}-${version}";
src = fetchPypi {
inherit pname version;
sha256 = "1yh5nbhh9z1am2pqnb5qqyq1zjl1m7z6jnkmvry2q14qwspw9had";
};
checkInputs = [ mock ];
buildInputs = [ nettools glibcLocales ];
propagatedBuildInputs = [ autobahn cffi click hkdf pynacl spake2 tqdm ];
postPatch = ''
sed -i -e "s|'ifconfig'|'${nettools}/bin/ifconfig'|" src/wormhole/ipaddrs.py
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
# XXX: disable one test due to warning:
# setlocale: LC_ALL: cannot change locale (en_US.UTF-8)
sed -i -e "s|def test_text_subprocess|def skip_test_text_subprocess|" src/wormhole/test/test_scripts.py
'';
checkPhase = ''
export PATH="$PATH:$out/bin"
export LANG="en_US.UTF-8"
export LC_ALL="en_US.UTF-8"
${python.interpreter} -m wormhole.test.run_trial wormhole
'';
meta = with lib; {
description = "Securely transfer data between computers";
homepage = "https://github.com/warner/magic-wormhole";
license = licenses.mit;
maintainers = with maintainers; [ asymmetric ];
};
}