linux_xanmod: 5.11.14 -> 5.11.15
[NixPkgs.git] / pkgs / development / python-modules / pypcap / default.nix
blobfbf6769ab4ca079f1cc09686570076ae3285c206
1 { lib
2 , buildPythonPackage
3 , dpkt
4 , fetchFromGitHub
5 , fetchpatch
6 , libpcap
7 , pytestCheckHook
8 }:
10 buildPythonPackage rec {
11   pname = "pypcap";
12   version = "1.2.3";
15   src = fetchFromGitHub {
16     owner = "pynetwork";
17     repo = pname;
18     rev = "v${version}";
19     sha256 = "1zscfk10jpqwxgc8d84y8bffiwr92qrg2b24afhjwiyr352l67cf";
20   };
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   ];
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   '';
38   buildInputs = [ libpcap ];
40   checkInputs = [
41     dpkt
42     pytestCheckHook
43   ];
45   pytestFlagsArray = [ "tests" ];
47   pythonImportsCheck = [ "pcap" ];
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   };