2018-05-21 20:53:50 +01:00
|
|
|
{ lib, writeText, buildPythonPackage, fetchPypi, libpcap, dpkt }:
|
2017-10-08 18:13:36 +01:00
|
|
|
|
|
|
|
buildPythonPackage rec {
|
|
|
|
pname = "pypcap";
|
2018-05-21 20:53:50 +01:00
|
|
|
version = "1.2.2";
|
2017-10-08 18:13:36 +01:00
|
|
|
|
|
|
|
src = fetchPypi {
|
|
|
|
inherit pname version;
|
2018-05-21 20:53:50 +01:00
|
|
|
sha256 = "07ww25z4xydp11hb38halh1940gmp5lca11hwfb63zv3bps248x3";
|
2017-10-08 18:13:36 +01: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
|
2018-05-21 20:53:50 +01:00
|
|
|
@@ -28,6 +28,7 @@ def recursive_search(path, target_files):
|
2017-10-08 18:13:36 +01:00
|
|
|
|
2018-05-21 20:53:50 +01:00
|
|
|
def find_prefix_and_pcap_h():
|
|
|
|
prefixes = chain.from_iterable((
|
|
|
|
+ '${libpcap}',
|
|
|
|
('/usr', sys.prefix),
|
|
|
|
glob.glob('/opt/libpcap*'),
|
|
|
|
glob.glob('../libpcap*'),
|
2017-10-08 18:13:36 +01:00
|
|
|
'')
|
|
|
|
];
|
|
|
|
|
2017-11-16 08:22:11 +00:00
|
|
|
buildInputs = [ libpcap ];
|
2018-05-21 20:53:50 +01:00
|
|
|
checkInputs = [ dpkt ];
|
2017-10-08 18:13:36 +01:00
|
|
|
|
2018-05-21 20:53:50 +01:00
|
|
|
meta = with lib; {
|
2017-10-08 18:13:36 +01:00
|
|
|
homepage = https://github.com/pynetwork/pypcap;
|
|
|
|
description = "Simplified object-oriented Python wrapper for libpcap";
|
2018-05-21 20:53:50 +01:00
|
|
|
license = licenses.bsd3;
|
|
|
|
maintainers = with maintainers; [ geistesk ];
|
2017-10-08 18:13:36 +01:00
|
|
|
};
|
|
|
|
}
|