summary refs log tree commit diff
path: root/pkgs/development/python-modules/magic-wormhole
diff options
context:
space:
mode:
authorFrederik Rietdijk <fridh@fridh.nl>2017-05-03 09:52:53 +0200
committerFrederik Rietdijk <fridh@fridh.nl>2017-05-03 09:52:53 +0200
commit664ff4069cb87aa4ab94f0e885ed1dab127bee15 (patch)
tree353bf0de7faf4b50cfb1e8220ab0e02d567ee65d /pkgs/development/python-modules/magic-wormhole
parent52b1995250c5dd7443c69818d469ef7db0299ffd (diff)
downloadnixpkgs-664ff4069cb87aa4ab94f0e885ed1dab127bee15.tar
nixpkgs-664ff4069cb87aa4ab94f0e885ed1dab127bee15.tar.gz
nixpkgs-664ff4069cb87aa4ab94f0e885ed1dab127bee15.tar.bz2
nixpkgs-664ff4069cb87aa4ab94f0e885ed1dab127bee15.tar.lz
nixpkgs-664ff4069cb87aa4ab94f0e885ed1dab127bee15.tar.xz
nixpkgs-664ff4069cb87aa4ab94f0e885ed1dab127bee15.tar.zst
nixpkgs-664ff4069cb87aa4ab94f0e885ed1dab127bee15.zip
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-`.
Diffstat (limited to 'pkgs/development/python-modules/magic-wormhole')
-rw-r--r--pkgs/development/python-modules/magic-wormhole/default.nix34
1 files changed, 25 insertions, 9 deletions
diff --git a/pkgs/development/python-modules/magic-wormhole/default.nix b/pkgs/development/python-modules/magic-wormhole/default.nix
index 483e9aa3a3b..99da5e83a87 100644
--- a/pkgs/development/python-modules/magic-wormhole/default.nix
+++ b/pkgs/development/python-modules/magic-wormhole/default.nix
@@ -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 {
-  name = "magic-wormhole-${version}";
+buildPythonPackage rec {
+  pname = "magic-wormhole";
   version = "0.8.1";
+  name = "${pname}-${version}";
 
-  src = fetchurl {
-    url = "mirror://pypi/m/magic-wormhole/${name}.tar.gz";
+  src = fetchPypi {
+    inherit pname version;
     sha256 = "1yh5nbhh9z1am2pqnb5qqyq1zjl1m7z6jnkmvry2q14qwspw9had";
   };
 
+  checkInputs = [ mock ];
   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|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:
@@ -24,10 +40,10 @@ pythonPackages.buildPythonApplication rec {
     export PATH="$PATH:$out/bin"
     export LANG="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";
     homepage = "https://github.com/warner/magic-wormhole";
     license = licenses.mit;