diff --git a/pkgs/development/python-modules/scapy/default.nix b/pkgs/development/python-modules/scapy/default.nix index 1f4a34d18a38..d7b2a827f7d1 100644 --- a/pkgs/development/python-modules/scapy/default.nix +++ b/pkgs/development/python-modules/scapy/default.nix @@ -1,30 +1,36 @@ -{ stdenv, buildPythonPackage, fetchFromGitHub, isPy3k, isPyPy +{ stdenv, lib, buildPythonPackage, fetchFromGitHub, isPyPy, isPy3k, pythonOlder , matplotlib, pycrypto, ecdsa -# Python3: pyx +, enum34, mock }: buildPythonPackage rec { pname = "scapy"; - version = "2.3.3"; + version = "2.4.0"; name = pname + "-" + version; - disabled = isPy3k || isPyPy; + disabled = isPyPy; src = fetchFromGitHub { owner = "secdev"; repo = "scapy"; rev = "v${version}"; - sha256 = "1c22407vhksnhc0rwrslnp9zy05qmk2zmdm2imm3iw7g6kx7gak1"; + sha256 = "0dw6kl1qi9bf3rbm79gb1h40ms8y0b5dbmpip841p2905d5r2isj"; }; - # Temporary workaround, only needed for 2.3.3 + # TODO: Temporary workaround patches = [ ./fix-version-1.patch ./fix-version-2.patch ]; - propagatedBuildInputs = [ matplotlib pycrypto ecdsa ]; + propagatedBuildInputs = + [ matplotlib pycrypto ecdsa ] + ++ lib.optional (isPy3k && pythonOlder "3.4") [ enum34 ] + ++ lib.optional doCheck [ mock ]; + + # Tests fail with Python 3.6 (seems to be an upstream bug, I'll investigate) + doCheck = if isPy3k then false else true; meta = with stdenv.lib; { description = "Powerful interactive network packet manipulation program"; - homepage = http://www.secdev.org/projects/scapy/; + homepage = https://scapy.net/; license = licenses.gpl2; platforms = platforms.linux; maintainers = with maintainers; [ primeos bjornfor ]; diff --git a/pkgs/development/python-modules/scapy/fix-version-1.patch b/pkgs/development/python-modules/scapy/fix-version-1.patch index 3864a41964e2..33d099e7a648 100644 --- a/pkgs/development/python-modules/scapy/fix-version-1.patch +++ b/pkgs/development/python-modules/scapy/fix-version-1.patch @@ -1,11 +1,11 @@ --- a/setup.py 2018-02-15 22:14:08.531591678 +0100 -+++ b/setup.py 2018-02-15 22:14:57.947703737 +0100 ++++ b/setup.py 2018-03-27 17:15:38.617315539 +0200 @@ -47,7 +47,7 @@ setup( name='scapy', - version=__import__('scapy').VERSION, -+ version='2.3.3', ++ version='2.4.0', packages=[ 'scapy', 'scapy/arch', diff --git a/pkgs/development/python-modules/scapy/fix-version-2.patch b/pkgs/development/python-modules/scapy/fix-version-2.patch index 62d43b51fbb9..41a195fb722f 100644 --- a/pkgs/development/python-modules/scapy/fix-version-2.patch +++ b/pkgs/development/python-modules/scapy/fix-version-2.patch @@ -1,11 +1,15 @@ ---- a/scapy/__init__.py 2017-12-29 18:57:35.315472160 +0100 -+++ b/scapy/__init__.py 2018-02-15 22:36:43.102132489 +0100 -@@ -73,7 +73,7 @@ - tag = f.read() - return tag - except: -- return 'unknown.version' -+ return '2.3.3' +--- a/scapy/__init__.py 2018-03-27 17:38:52.706481269 +0200 ++++ b/scapy/__init__.py 2018-03-27 17:39:56.576688890 +0200 +@@ -82,9 +82,10 @@ + if match: + return "git-archive.dev" + match.group(1) + elif sha1: +- return "git-archive.dev" + sha1 ++ return '2.4.0' + else: +- return 'unknown.version' ++ return '2.4.0' ++ VERSION = _version()