at 22.05-pre 1.3 kB view raw
1{ lib 2, buildPythonPackage 3, dpkt 4, fetchFromGitHub 5, fetchpatch 6, libpcap 7, pytestCheckHook 8}: 9 10buildPythonPackage rec { 11 pname = "pypcap"; 12 version = "1.2.3"; 13 14 15 src = fetchFromGitHub { 16 owner = "pynetwork"; 17 repo = pname; 18 rev = "v${version}"; 19 sha256 = "1zscfk10jpqwxgc8d84y8bffiwr92qrg2b24afhjwiyr352l67cf"; 20 }; 21 22 patches = [ 23 # Support for Python 3.9, https://github.com/pynetwork/pypcap/pull/102 24 (fetchpatch { 25 name = "support-python-3.9.patch"; 26 url = "https://github.com/pynetwork/pypcap/pull/102/commits/e22f5d25f0d581d19ef337493434e72cd3a6ae71.patch"; 27 sha256 = "0n1syh1vcplgsf6njincpqphd2w030s3b2jyg86d7kbqv1w5wk0l"; 28 }) 29 ]; 30 31 postPatch = '' 32 # Add the path to libpcap in the nix-store 33 substituteInPlace setup.py --replace "('/usr', sys.prefix)" "'${libpcap}'" 34 # Remove coverage from test run 35 sed -i "/--cov/d" setup.cfg 36 ''; 37 38 buildInputs = [ libpcap ]; 39 40 checkInputs = [ 41 dpkt 42 pytestCheckHook 43 ]; 44 45 pytestFlagsArray = [ "tests" ]; 46 47 pythonImportsCheck = [ "pcap" ]; 48 49 meta = with lib; { 50 homepage = "https://github.com/pynetwork/pypcap"; 51 description = "Simplified object-oriented Python wrapper for libpcap"; 52 license = licenses.bsd3; 53 maintainers = with maintainers; [ oxzi ]; 54 }; 55}