From 664ff4069cb87aa4ab94f0e885ed1dab127bee15 Mon Sep 17 00:00:00 2001 From: Frederik Rietdijk Date: Wed, 3 May 2017 09:52:53 +0200 Subject: [PATCH] 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-`. --- .../python-modules/magic-wormhole/default.nix | 34 ++++++++++++++----- pkgs/top-level/python-packages.nix | 4 +-- 2 files changed, 26 insertions(+), 12 deletions(-) diff --git a/pkgs/development/python-modules/magic-wormhole/default.nix b/pkgs/development/python-modules/magic-wormhole/default.nix index 483e9aa3a3b9..99da5e83a875 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; diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix index 0c03eed465e6..774ef2fb0fcf 100644 --- a/pkgs/top-level/python-packages.nix +++ b/pkgs/top-level/python-packages.nix @@ -26804,9 +26804,7 @@ EOF }; }); - magic-wormhole = callPackage ../development/python-modules/magic-wormhole { - pythonPackages = self; - }; + magic-wormhole = callPackage ../development/python-modules/magic-wormhole { }; wsgiproxy2 = buildPythonPackage rec { name = "WSGIProxy2-0.4.2";