nixpkgs/pkgs/development/python-modules/scapy/default.nix

56 lines
1.8 KiB
Nix
Raw Normal View History

{ buildPythonPackage, fetchFromGitHub, lib, isPyPy, isPy3k, pythonOlder
, pycrypto, ecdsa # TODO
2018-03-27 17:26:03 +01:00
, enum34, mock
, withOptionalDeps ? true, tcpdump, ipython
, withCryptography ? true, cryptography
, withVoipSupport ? true, sox
, withPlottingSupport ? true, matplotlib
, withGraphicsSupport ? false, pyx, texlive, graphviz, imagemagick
, withManufDb ? false, wireshark
# 2D/3D graphics and graphs TODO: VPython
# TODO: nmap, numpy
2018-02-15 21:40:01 +00:00
}:
buildPythonPackage rec {
pname = "scapy";
2019-08-07 12:48:26 +01:00
version = "2.4.3";
2018-03-27 17:26:03 +01:00
disabled = isPyPy;
2018-02-15 21:40:01 +00:00
src = fetchFromGitHub {
owner = "secdev";
repo = "scapy";
rev = "v${version}";
2019-08-07 12:48:26 +01:00
sha256 = "08ypdzp0p3gvmz3pwi0i9q5f7hz9cq8yn6gawia49ynallwnv4zy";
};
2018-03-27 17:26:03 +01:00
# TODO: Temporary workaround
2019-01-10 13:47:02 +00:00
patches = [ ./fix-version.patch ];
2018-02-15 21:40:01 +00:00
2019-01-10 13:47:02 +00:00
postPatch = ''
2019-08-07 12:48:26 +01:00
sed -i "s/NIXPKGS_SCAPY_VERSION/${version}/" scapy/__init__.py
2019-01-10 13:47:02 +00:00
'' + lib.optionalString withManufDb ''
substituteInPlace scapy/data.py --replace "/opt/wireshark" "${wireshark}"
'';
propagatedBuildInputs = [ pycrypto ecdsa ]
++ lib.optionals withOptionalDeps [ tcpdump ipython ]
++ lib.optional withCryptography cryptography
++ lib.optional withVoipSupport sox
++ lib.optional withPlottingSupport matplotlib
++ lib.optionals withGraphicsSupport [ pyx texlive.combined.scheme-minimal graphviz imagemagick ]
++ lib.optional (isPy3k && pythonOlder "3.4") enum34
++ lib.optional doCheck mock;
2018-03-27 17:26:03 +01:00
# Tests fail with Python 3.6 (seems to be an upstream bug, I'll investigate)
doCheck = if isPy3k then false else true;
2018-02-15 21:40:01 +00:00
meta = with lib; {
description = "Powerful interactive network packet manipulation program";
homepage = "https://scapy.net/";
license = licenses.gpl2;
platforms = platforms.unix;
2018-02-15 21:40:01 +00:00
maintainers = with maintainers; [ primeos bjornfor ];
};
}