nixpkgs-suyu/pkgs/development/python-modules/pypcap/default.nix

40 lines
1.1 KiB
Nix
Raw Normal View History

{ lib, writeText, buildPythonPackage, fetchPypi, libpcap, dpkt }:
2017-10-08 19:13:36 +02:00
buildPythonPackage rec {
pname = "pypcap";
version = "1.2.2";
2017-10-08 19:13:36 +02:00
src = fetchPypi {
inherit pname version;
sha256 = "07ww25z4xydp11hb38halh1940gmp5lca11hwfb63zv3bps248x3";
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
@@ -28,6 +28,7 @@ def recursive_search(path, target_files):
2017-10-08 19:13:36 +02: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 19:13:36 +02:00
'')
];
2017-11-16 09:22:11 +01:00
buildInputs = [ libpcap ];
checkInputs = [ dpkt ];
2017-10-08 19:13:36 +02:00
meta = with lib; {
2017-10-08 19:13:36 +02:00
homepage = https://github.com/pynetwork/pypcap;
description = "Simplified object-oriented Python wrapper for libpcap";
license = licenses.bsd3;
maintainers = with maintainers; [ geistesk ];
2017-10-08 19:13:36 +02:00
};
}