Merge pull request #307098 from r-ryantm/auto-update/cilium-cli
[NixPkgs.git] / pkgs / development / python-modules / pypcap / default.nix
blob2c3997c8941aa007d15aecbbb2aefe9b89d9e5c8
1 { lib
2 , buildPythonPackage
3 , dpkt
4 , fetchFromGitHub
5 , libpcap
6 , pytestCheckHook
7 }:
9 buildPythonPackage rec {
10   pname = "pypcap";
11   version = "1.3.0";
12   format = "setuptools";
14   src = fetchFromGitHub {
15     owner = "pynetwork";
16     repo = pname;
17     # No release was tagged and PyPI doesn't contain tests.
18     rev = "968859f0ffb5b7c990506dffe82457b7de23a026";
19     hash = "sha256-NfyEC3qEBm6TjebcDIsoz8tJWaJ625ZFPfx7AMyynWE=";
20   };
22   postPatch = ''
23     # Add the path to libpcap in the nix-store
24     substituteInPlace setup.py --replace "('/usr', sys.prefix)" "'${libpcap}'"
25     # Remove coverage from test run
26     sed -i "/--cov/d" setup.cfg
27   '';
29   buildInputs = [ libpcap ];
31   nativeCheckInputs = [
32     dpkt
33     pytestCheckHook
34   ];
36   pytestFlagsArray = [ "tests" ];
38   pythonImportsCheck = [ "pcap" ];
40   meta = with lib; {
41     homepage = "https://github.com/pynetwork/pypcap";
42     description = "Simplified object-oriented Python wrapper for libpcap";
43     license = licenses.bsd3;
44     maintainers = with maintainers; [ oxzi ];
45   };