2024-06-05 15:53:02 +00:00
|
|
|
{
|
|
|
|
lib,
|
|
|
|
buildPythonPackage,
|
|
|
|
dpkt,
|
|
|
|
fetchFromGitHub,
|
|
|
|
libpcap,
|
|
|
|
pytestCheckHook,
|
2021-02-22 21:28:39 +00:00
|
|
|
}:
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
buildPythonPackage rec {
|
|
|
|
pname = "pypcap";
|
2022-11-04 12:27:35 +00:00
|
|
|
version = "1.3.0";
|
2024-01-02 11:29:13 +00:00
|
|
|
format = "setuptools";
|
2021-02-22 21:28:39 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "pynetwork";
|
|
|
|
repo = pname;
|
2022-11-04 12:27:35 +00:00
|
|
|
# No release was tagged and PyPI doesn't contain tests.
|
|
|
|
rev = "968859f0ffb5b7c990506dffe82457b7de23a026";
|
2023-03-15 16:39:30 +00:00
|
|
|
hash = "sha256-NfyEC3qEBm6TjebcDIsoz8tJWaJ625ZFPfx7AMyynWE=";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
2021-02-22 21:28:39 +00:00
|
|
|
postPatch = ''
|
|
|
|
# Add the path to libpcap in the nix-store
|
|
|
|
substituteInPlace setup.py --replace "('/usr', sys.prefix)" "'${libpcap}'"
|
|
|
|
# Remove coverage from test run
|
|
|
|
sed -i "/--cov/d" setup.cfg
|
|
|
|
'';
|
|
|
|
|
2020-04-24 23:36:52 +00:00
|
|
|
buildInputs = [ libpcap ];
|
2021-02-22 21:28:39 +00:00
|
|
|
|
2023-02-02 18:25:31 +00:00
|
|
|
nativeCheckInputs = [
|
2021-02-22 21:28:39 +00:00
|
|
|
dpkt
|
|
|
|
pytestCheckHook
|
|
|
|
];
|
|
|
|
|
|
|
|
pytestFlagsArray = [ "tests" ];
|
|
|
|
|
|
|
|
pythonImportsCheck = [ "pcap" ];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
meta = with lib; {
|
|
|
|
homepage = "https://github.com/pynetwork/pypcap";
|
|
|
|
description = "Simplified object-oriented Python wrapper for libpcap";
|
|
|
|
license = licenses.bsd3;
|
2020-08-20 17:08:02 +00:00
|
|
|
maintainers = with maintainers; [ oxzi ];
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
}
|