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";
|
2019-08-05 16:16:11 +01:00
|
|
|
version = "1.2.3";
|
2017-10-08 18:13:36 +01:00
|
|
|
|
|
|
|
src = fetchPypi {
|
|
|
|
inherit pname version;
|
2019-08-05 16:16:11 +01:00
|
|
|
sha256 = "1w5i79gh7cswvznr8rhilcmzhnh2y5c4jwh2qrfnpx05zqigm1xd";
|
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; {
|
2020-04-01 02:11:51 +01:00
|
|
|
homepage = "https://github.com/pynetwork/pypcap";
|
2017-10-08 18:13:36 +01:00
|
|
|
description = "Simplified object-oriented Python wrapper for libpcap";
|
2018-05-21 20:53:50 +01:00
|
|
|
license = licenses.bsd3;
|
2020-08-15 14:25:59 +01:00
|
|
|
maintainers = with maintainers; [ oxzi ];
|
2017-10-08 18:13:36 +01:00
|
|
|
};
|
|
|
|
}
|