nixpkgs/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 18:13:36 +01:00
buildPythonPackage rec {
pname = "pypcap";
version = "1.2.3";
2017-10-08 18:13:36 +01:00
src = fetchPypi {
inherit pname version;
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
@@ -28,6 +28,7 @@ def recursive_search(path, target_files):
2017-10-08 18:13:36 +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 ];
checkInputs = [ dpkt ];
2017-10-08 18:13:36 +01:00
meta = with lib; {
homepage = "https://github.com/pynetwork/pypcap";
2017-10-08 18:13:36 +01:00
description = "Simplified object-oriented Python wrapper for libpcap";
license = licenses.bsd3;
maintainers = with maintainers; [ oxzi ];
2017-10-08 18:13:36 +01:00
};
}