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-`.
This commit is contained in:
Frederik Rietdijk
2017-05-03 09:52:53 +02:00
parent 52b1995250
commit 664ff4069c
2 changed files with 26 additions and 12 deletions
@@ -1,18 +1,34 @@
{ stdenv, fetchurl, nettools, glibcLocales, pythonPackages }: { lib
, buildPythonPackage
, fetchPypi
, nettools
, glibcLocales
, autobahn
, cffi
, click
, hkdf
, pynacl
, spake2
, tqdm
, python
, mock
}:
pythonPackages.buildPythonApplication rec { buildPythonPackage rec {
name = "magic-wormhole-${version}"; pname = "magic-wormhole";
version = "0.8.1"; version = "0.8.1";
name = "${pname}-${version}";
src = fetchurl { src = fetchPypi {
url = "mirror://pypi/m/magic-wormhole/${name}.tar.gz"; inherit pname version;
sha256 = "1yh5nbhh9z1am2pqnb5qqyq1zjl1m7z6jnkmvry2q14qwspw9had"; sha256 = "1yh5nbhh9z1am2pqnb5qqyq1zjl1m7z6jnkmvry2q14qwspw9had";
}; };
checkInputs = [ mock ];
buildInputs = [ nettools glibcLocales ]; buildInputs = [ nettools glibcLocales ];
propagatedBuildInputs = with pythonPackages; [ autobahn cffi click hkdf pynacl spake2 tqdm ]; propagatedBuildInputs = [ autobahn cffi click hkdf pynacl spake2 tqdm ];
patchPhase = '' postPatch = ''
sed -i -e "s|'ifconfig'|'${nettools}/bin/ifconfig'|" src/wormhole/ipaddrs.py 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 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: # XXX: disable one test due to warning:
@@ -24,10 +40,10 @@ pythonPackages.buildPythonApplication rec {
export PATH="$PATH:$out/bin" export PATH="$PATH:$out/bin"
export LANG="en_US.UTF-8" export LANG="en_US.UTF-8"
export LC_ALL="en_US.UTF-8" export LC_ALL="en_US.UTF-8"
${pythonPackages.python.interpreter} -m wormhole.test.run_trial wormhole ${python.interpreter} -m wormhole.test.run_trial wormhole
''; '';
meta = with stdenv.lib; { meta = with lib; {
description = "Securely transfer data between computers"; description = "Securely transfer data between computers";
homepage = "https://github.com/warner/magic-wormhole"; homepage = "https://github.com/warner/magic-wormhole";
license = licenses.mit; license = licenses.mit;
+1 -3
View File
@@ -26804,9 +26804,7 @@ EOF
}; };
}); });
magic-wormhole = callPackage ../development/python-modules/magic-wormhole { magic-wormhole = callPackage ../development/python-modules/magic-wormhole { };
pythonPackages = self;
};
wsgiproxy2 = buildPythonPackage rec { wsgiproxy2 = buildPythonPackage rec {
name = "WSGIProxy2-0.4.2"; name = "WSGIProxy2-0.4.2";