1{ lib
2, stdenv
3, buildPythonPackage
4, fetchPypi
5, pythonOlder
6, dbus
7, pkgsLibpcap
8, pkg-about
9, setuptools
10, tox
11}:
12
13buildPythonPackage rec {
14 pname = "libpcap";
15 version = "1.11.0b7";
16 format = "pyproject";
17
18 disabled = pythonOlder "3.7";
19
20 src = fetchPypi {
21 inherit pname version;
22 extension = "zip";
23 hash = "sha256-gEWFqmeOJTVHdjcSOxfVLZtrNSO3CTY1L2VcXOu7q7k=";
24 };
25
26 nativeBuildInputs = [
27 setuptools
28 tox
29 ];
30
31 postPatch = ''
32 cat <<EOF >src/libpcap/libpcap.cfg
33 [libpcap]
34 LIBPCAP = ${pkgsLibpcap}/lib/libpcap${stdenv.hostPlatform.extensions.sharedLibrary}
35 EOF
36 '';
37
38 propagatedBuildInputs = [
39 dbus.lib
40 pkgsLibpcap
41 pkg-about
42 ];
43
44 # Project has tests, but I can't get them to run even outside of nix
45 doCheck = false;
46
47 pythonImportsCheck = [
48 "libpcap"
49 ];
50
51 meta = with lib; {
52 description = "Python binding for the libpcap C library";
53 longDescription = ''
54 Python libpcap module is a low-level binding for libpcap C library.
55
56 It is an effort to allow python programs full access to the API provided by the well known libpcap Unix C library and by its implementations provided under Win32 systems by such packet capture systems as: Npcap, WinPcap
57
58 libpcap is a lightweight Python package, based on the ctypes library.
59
60 It is fully compliant implementation of the original C libpcap from 1.0.0 up to 1.9.0 API and the WinPcap’s 4.1.3 libpcap (1.0.0rel0b) API by implementing whole its functionality in a clean Python instead of C.
61 '';
62 homepage = "https://github.com/karpierz/libpcap/";
63 license = licenses.bsd3;
64 maintainers = [ teams.ororatech ];
65 };
66}