2017-11-16 09:22:11 +01:00
|
|
|
{ stdenv, lib, writeText, buildPythonPackage, fetchPypi, libpcap, dpkt }:
|
2017-10-08 19:13:36 +02:00
|
|
|
|
|
|
|
buildPythonPackage rec {
|
|
|
|
pname = "pypcap";
|
2017-11-16 09:22:11 +01:00
|
|
|
version = "1.2.0";
|
2017-10-08 19:13:36 +02:00
|
|
|
name = "${pname}-${version}";
|
|
|
|
|
|
|
|
src = fetchPypi {
|
|
|
|
inherit pname version;
|
2017-11-16 09:22:11 +01:00
|
|
|
sha256 = "0n01xjgg8n5mf1cs9yg9ljsx1kvir8cm6wwrd2069fawjxdbk0b9";
|
2017-10-08 19:13:36 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
patches = [
|
|
|
|
# The default setup.py searchs for pcap.h in a static list of default
|
|
|
|
# folders. So we have to add the path to libpcap in the nix-store.
|
|
|
|
(writeText "libpcap-path.patch"
|
|
|
|
''
|
|
|
|
--- a/setup.py
|
|
|
|
+++ b/setup.py
|
|
|
|
@@ -27,7 +27,8 @@ def recursive_search(path, target_files):
|
|
|
|
|
|
|
|
def get_extension():
|
|
|
|
# A list of all the possible search directories
|
|
|
|
- dirs = ['/usr', sys.prefix] + glob.glob('/opt/libpcap*') + \
|
|
|
|
+ dirs = ['${libpcap}', '/usr', sys.prefix] + \
|
|
|
|
+ glob.glob('/opt/libpcap*') + \
|
|
|
|
glob.glob('../libpcap*') + glob.glob('../wpdpack*') + \
|
|
|
|
glob.glob('/Applications/Xcode.app/Contents/Developer/Platforms/' +
|
|
|
|
'MacOSX.platform/Developer/SDKs/*')
|
|
|
|
'')
|
|
|
|
];
|
|
|
|
|
2017-11-16 09:22:11 +01:00
|
|
|
buildInputs = [ libpcap ];
|
|
|
|
nativeBuildInputs = [ dpkt ];
|
2017-10-08 19:13:36 +02:00
|
|
|
|
|
|
|
meta = {
|
|
|
|
homepage = https://github.com/pynetwork/pypcap;
|
|
|
|
description = "Simplified object-oriented Python wrapper for libpcap";
|
|
|
|
license = lib.licenses.bsd3;
|
|
|
|
maintainers = with lib.maintainers; [ geistesk ];
|
|
|
|
};
|
|
|
|
}
|